Answer the following questions using the New York City data from the Boundless PostGIS Workshop.
- Write a query to return a list of subway stations (
gid
andname
) that are within 500 meters of another subway station. Hint: This will require a “self-join”, where thenyc_subway_stations
table will have to be listed twice (and aliased) in theFROM
clause of the query. - Write an aggregate query that returns the total length of all street segments that intersect a 500m buffer of the 7 train stop (check the
routes
column) at Grand Central station. Do not clip the street segments (i.e., do not use theST_Intersection
function). If a street segment is partially in the boundary, count its entire length. - Write a query that determines whether any census blocks are in more than one neighborhood. Make sure to use a function or functions that do not count the block as “in” if it only shares a boundary with the neighborhood. HINT: Previewing the data in QGIS or ArcGIS will help you know whether your query results make sense.
- Write a query that returns the population of the Astoria-Long Island City neighborhood. The population data is in
nyc_census_blocks
. Assume that any block which partially shares area with the neighborhood is “in”. Based on the answer to the previous question, is this answer exact, or might it include some census blocks which extend beyond the neighborhood boundary?