National Map Viewer: Difference between revisions
From charlesreid1
(→D3) |
No edit summary |
||
| Line 1: | Line 1: | ||
=About= | |||
The National Map Viewer is an online service provided by USGS that allows citizens to download high-quality topographical and geographical information. | |||
=3D Map Project= | =3D Map Project= | ||
Revision as of 20:01, 28 July 2016
About
The National Map Viewer is an online service provided by USGS that allows citizens to download high-quality topographical and geographical information.
3D Map Project
Ultimate goal: http://setosa.io/blog/2014/08/10/woodcut-data-visualization/
Start from Shapefiles. Use ogr2ogr (a utility that comes with GDAL) to convert Shapefiles to GeoJSON.
Use D3 to pick a projection and convert GeoJSON latitude/longitude to vector (x,y) and SVG format.
What You'll Need
You will need a few different pieces of software for each step. These are covered below.
GDAL
To convert Shapefiles into GeoJSON format, you can use a utility called ogr2ogr, which is installed along with the GDAL framework.
On a Mac, the simplest way to install this is not to download and install a dozen packages from the internet, but rather to use Homebrew:
brew install gdal
D3
The D3 (data driven documents) software library is a Javascript library that can be used to draw maps and do projections. It has software built in to do a mapping of (lat,long) -> (x,y).
This is pretty straightforward to use: since it's Javascript it can be used on an HTML page.
You don't have to install anything, you just include the D3 library from your Javascript code, and you have everything at the ready.
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