Goal: be able to compute geo files (.shp, kml, geojson, topojson for arbitrary census geographic entities)
http://127.0.0.1:8888/notebooks/wwod13/nhgis_2013_10_16.ipynb
On my mac, I installed binaries from Build Notes [KyngChaos Wiki] -> but I see
conda install gdal
will give you command line tools like ogr2ogr
Documentation: GDAL: ogr2ogr -- see whether How to convert Shapefiles to GeoJSON maps for use on GitHub (and why you should) » Ben Balter gives the right incantation:
ogr2ogr -f GeoJSON -t_srs crs:84 [name].geojson [name].shp
In [1]:
!ls /Users/raymondyee/Downloads/tl_2010_06001_bg00/tl_2010_06001_bg00.shp
In [2]:
!rm /Users/raymondyee/Downloads/tl_2010_06001_bg00/tl_2010_06001_bg00.geojson
!/Library/Frameworks/Python.framework/Versions/Current/bin/ogr2ogr -f GeoJSON /Users/raymondyee/Downloads/tl_2010_06001_bg00/tl_2010_06001_bg00.geojson /Users/raymondyee/Downloads/tl_2010_06001_bg00/tl_2010_06001_bg00.shp
#!ogr2ogr -f GeoJSON -t_srs crs:84 /Users/raymondyee/Downloads/tl_2010_06001_bg00/tl_2010_06001_bg00.geojson /Users/raymondyee/Downloads/tl_2010_06001_bg00/tl_2010_06001_bg00.shp
ogr2ogr -f GeoJSON tl_2010_06001_bg00.geojson tl_2010_06001_bg00.shp
ogr2ogr -f GeoJSON tl_2010_06001_tract10.geojson tl_2010_06001_tract10.shp
In [3]:
import gdal
import ogr
import osr
import gdalnumeric
import gdalconst
In [ ]: