From charlesreid1

This page covers part 2 of my process for dealing with shapefile topography data from the National Map viewer in Leaflet.

Inspired by this D3 sketch: http://bl.ocks.org/herrstucki/6312708

Github readme for that sketch here: https://github.com/interactivethings/swiss-maps/blob/master/README.md

Ultimate goal: map topo data from the National Map Viewer (maybe even automated somehow!)

National Map Viewer

http://nationalmap.gov/viewer.html

Downloading Shapefile Topo Data

Selecting a location for which I wanted topological data, I faced the dilemma of not knowing which data set to select.

I narrowed the view down to a specific region. I then clicked the download data link at the top.

I was presented with an array of choices, and I chose "Contour" data. This gave me multiple shape files, two of which covered the region of interest. I went through the checkout process to download these two shapefiles.

The region that I'm looking at is the Barry Goldwater Bombing Range outside of Yuma, Arizona, on the southwest Arizona-Mexico border.

Loading into QGIS

Here is what the shapefile looks like when loaded in QGIS... woah!

Shapefile Topo.png


Converting

Shapefile to TopoJson

To convert this shapefile to something like TopoJson, I can use the TopoJson utility, which I installed as part of making my D3 Map (see http://charlesreid1.com/wiki/D3_Map#GeoJson_to_TopoJson).

Here is an example of a topojson call, from this page [1]:

topojson --id-property NR -p name=NAVN -p name -o NO_Admin_UTM33.topojson NO_Fylker_pol.shp NO_Kommuner_pol.shp

For my file, in the folder Elev_321166_Ajo_E_1X1/, I can convert the shapefile, Elev_Contour.shp:

$ topojson Elev_Contour.shp -o Elev_Contour.topojson -p
bounds: -112.99999999999994 32.00000000000006 -112.00000000013563 33.00000000086072 (spherical)
pre-quantization: 0.111m (0.00000100°) 0.111m (0.00000100°)
topology: 38071 arcs, 4228784 points
post-quantization: 11.1m (0.000100°) 11.1m (0.000100°)
prune: retained 38071 / 38071 arcs (100%)