NYC Open Data Examples




Pay Notebook Creator: Roy Hyunjin Han0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [8]:
import subprocess
subprocess.call('pip install mapbox'.split())
Out[8]:
0

Which Senior Centers are Close to the Coast?

In [1]:
nyc_shoreline_geojson_url = 'https://data.cityofnewyork.us/api/geospatial/2qj2-cctx?method=export&format=GeoJSON'
In [2]:
import requests
response = requests.get(nyc_shoreline_geojson_url)
response_json = response.json()
In [3]:
from shapely.geometry import GeometryCollection, shape
features = response_json['features']
shoreline_geometry = GeometryCollection([shape(f['geometry']) for f in features])
In [6]:
shoreline_geometry.simplify(0.01)
Out[6]:
<shapely.geometry.collection.GeometryCollection at 0x7f639009f6a0>
In [ ]:
# Get coastline
# Get senior centers
# Get subway stations