Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Forked from lxbarth/nycneighborhoods.md
Created May 14, 2014 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wizardishungry/6c6a099c4415ba4f8f09 to your computer and use it in GitHub Desktop.
Save wizardishungry/6c6a099c4415ba4f8f09 to your computer and use it in GitHub Desktop.

Download and convert data from NYC open data portal

curl -o nynta.zip "https://nycopendata.socrata.com/api/geospatial/cpf4-rkhq?method=export&format=Shapefile"
cd nynta_12c

ogr2ogr can't deal with the projection directly. Replace content of nynta.prj with the following projection string:

PROJCS["NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["lambert_conformal_conic_2sp"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["longitude_of_center",-74.0],PARAMETER["Standard_Parallel_1",40.66666666666666],PARAMETER["Standard_Parallel_2",41.03333333333333],PARAMETER["latitude_of_center",40.16666666666666],UNIT["Foot_US",0.3048006096012192]]

Then reproject and simplify using ogr2ogr

ogr2ogr -f "GeoJSON" -s_srs nynta.prj -t_srs EPSG:4326 -simplify 10 nycneighborhoods.geojson nynta.shp

Now copy the JSON object of nycneighborhoods.geojson into nycneighborhoods.js so that var neighborhoods = <contentsofnycneighborhoods.geojson>;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment