Skip to content

Instantly share code, notes, and snippets.

@lxbarth
Last active December 16, 2015 14:59
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lxbarth/5452832 to your computer and use it in GitHub Desktop.
Save lxbarth/5452832 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>;.

@hjoseph96
Copy link

happen to still have this geojson? ogr2ogr messes up for me for whatever reason

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