Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

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>;.

@ghost

ghost commented Jul 7, 2014

Hi Ixbarth!

I have followed an example over at mapbox.com (https://www.mapbox.com/blog/neighborhood-mapping-with-dynamic-vector-data-layers/) where they use your technique for fixing the GeoJson-file into the right format. My problem now is that I have a shapefile for the different areas in Stockholm, Sweden instead, and try to use the tutorial over at mapbox. Unfortunately I can't get it right and wonder if you have any set-up tips for different shapefiles?

Thank in advance!

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