This assignment makes use of data from the Introduction to PostGIS Workshop (prefixed with nyc_
and Natural Earth Data (prefixed with ne_
).
- Create a query which measures the area of all the neighborhoods in the
nyc_neighborhoods
table. Write one query which displays the neighborhood name, area as calculated in UTM 18N (which the data is stored in), New York State Plane Long Island (look up the appropriate SRID), and on the WGS 84 spheroid by casting to the geography type. Make sure to pay attention to the units, and convert all the outputs to square kilometers. - Create a query which calculates the distance from 4/5/6 Grand Central Station stop to every neighborhood in
nyc_neighborhoods
. Use a subquery to select thegeom
only for Grand Central Station as one of the input parameters to the distance function. Show the neighborhood name and calculate the distance using UTM 18N (which the data is stored in), New York State Plane Long Island, and on the WGS 84 spheroid by casting to the geography type. Make sure to pay attention to the units, and convert all the outputs to kilometers. - Create a query which calculates distance from Philadelphia to the five most populous cities in the table
ne_10m_populated_places
(use thepop_max
column for population size). Include the table name and the following distances:- the distance in the coordinate system as stored (decimal degrees, which will be useless)
- the distance in Web Mercator (which will also be useless)
- the geodetic distance using a geography cast