Exercise: Spatial Reference Systems

This assignment makes use of data from the Introduction to PostGIS Workshop (prefixed with nyc_ and Natural Earth Data (prefixed with ne_).

  1. 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.
  2. 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 the geom 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.
  3. Create a query which calculates distance from Philadelphia to the five most populous cities in the table ne_10m_populated_places (use the pop_max column for population size). Include the table name and the following distances:
    1. the distance in the coordinate system as stored (decimal degrees, which will be useless)
    2. the distance in Web Mercator (which will also be useless)
    3. the geodetic distance using a geography cast