⚡ GMapsBook.com is crafted by Jozef Sorocin (🟢 Book a consulting hour) and powered by:
In the parent chapter we briefly explored Google Maps’ native transit layer.
In this chapter, we’ll attempt to replicate this layer using publicly available GeoJSON data and learn a thing or two about Google Maps’ interactive data layers.
I’m a city planner analyzing the proximity of New York City subway lines to new developments.
To start off, I’d like to view and highlight the metro lines:
https://storage.googleapis.com/gmaps-handbook/public/common/5/5.1/highlighting-nyc-subway-lines.mp4
As you saw in the chapter on Turf.js & Exporting to GeoJSON, the GeoJSON format is a popular mechanism to encode and share geospatial data.
Many cities, agencies, and non-profits publish valuable GeoJSON data online. In your case, the city agency of choice would be NYC Open Data. Searching for “subway lines” leads to a promising dataset. From there, under “Export”, you’ll need to copy the GeoJSON URL:
To quickly inspect the geometries and properties
of this small dataset, you can use geojson.io.
Indeed, you’re dealing with a FeatureCollection
containing features of the form:
{
"type": "Feature",
"properties": {
"name": "A-C",
"url": "<http://web.mta.info/nyct/service/>",
"rt_symbol": "A",
"objectid": "800",
"id": "2000251",
"shape_len": "2714.92372395"
},
"geometry": {
"type": "LineString",
"coordinates": [
[-73.88075000161994, 40.674129666468296],
[-73.89035800079188, 40.67270966767174]
]
}
}