Getting ready

To begin, create the schema for this chapter as chp11; then, download data from the U.S. Census Bureau's FTP site:

http://ftp2.census.gov/geo/tiger/TIGER2012/EDGES/tl_2012_39035_edges.zip

The shapefile is All Lines for Cuyahoga county in Ohio, which consist of roads and streams among other line features.

Extract the ZIP file to your working directory and then load it into your database using shp2pgsql. Be sure to specify the spatial reference system, EPSG/SRID: 4269. When in doubt about using projections, use the service provided by the folks at OpenGeo at the following website: http://prj2epsg.org/search

Use the following command to generate the SQL to load the shapefile in a table of the chp11 schema:

shp2pgsql -s 4269 -W ...

Get PostGIS Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.