From charlesreid1

Line 26: Line 26:


This will install a utility called <code>ogr2ogr</code>, which we'll use to convert shapefiles to GeoJSON files.
This will install a utility called <code>ogr2ogr</code>, which we'll use to convert shapefiles to GeoJSON files.
<pre>
ogr2ogr -f GeoJSON -t_srs crs:84 Elev_Contour.geojson Elev_Contour.shp
</pre>

Revision as of 10:07, 28 July 2016

Shapefiles

Getting Shapefile Data

To download elevation data in shapefile format:

Zoom into the area you want

Check "US Topo" and click Find Products

Next to each item, there are four links - the third one is "Download"

Download the shapefile data and unzip it

Shapefiles to GeoJSON

We'll convert these shapefiles to something better for the web: GeoJSON

See http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/

Install homebrew, then:

brew install gdal

This will install a utility called ogr2ogr, which we'll use to convert shapefiles to GeoJSON files.

ogr2ogr -f GeoJSON -t_srs crs:84 Elev_Contour.geojson Elev_Contour.shp