Skip to content
Perta edited this page Feb 10, 2015 · 2 revisions

What is Toposm?

Toposm is the combination of automated scripts and a set of styles that will take raw GIS data and turn it into a topographic map. The project has three main steps. The first is downloading the data. The biggest challenge is finding the current location of data as administrators move these file around. The next step is importing the data into the PostgreSQL/Postgis database. PostrgresSQL is a flavor of a SQL database and and Postgis is an extension gives the database GIS specific functionality. My biggest challenges was getting this set up correctly. Finally, TopOSM uses Mapnik to pull the data out of the database and render it into a map. The three skills that are most helpful in using this project are PostgreSQL database administration, bash scripts, and python

What it isn't?

The current status of this project will not allow to just download an executable program, double click, open up a nice GUI and starting printing off maps. You will need to adjust this project to your specific needs.

Requirements

OS I installed this project on Ubuntu 14.04. At one point, I tried a virtual computer with 11.04 installed to match the current version at the time 3 years ago when the project was last worked on but this caused more problems. I would recommend anyone with Windows or Mac to try a virtual Linux machine to minimize OS specific issues.

Mapnik The project includes a patch for Mapnik. The patch will only work on 2.0 and not the newer versions. I couldn't find Mapnik 2.0 in software repositories so I had to compile the source code. This version of Mapnik does seem to have a bug with SVG files. I got around this problem by pointing the xml files to the PNG equivalent.

PostgreSQL / Postgis Setting up the database and adding GIS tools killed a lot of time. I would install the suggested packages in the read me file (postgresql postgresql-contrib postgresql-server-dev-8.4 postgis) and follow more current online instructions. The troubleshooting information is all in stackexchange, but most of the solutions did not apply to my case. In short, follow this PostgresSQl instruction and this one for Postgis.

Required Packages  

I just threw the whole list into "sudo apt-get install ..." and hoped for the best. Some packages seemed old, so googled for a newer version. I wouldn't install postgresql postgresql-contrib postgresql-server-dev-8.4 and follow the postgresql server instructions instead.

Required data files

Sourcing the data files took some time. Over the last 3 years, the sources have changed and you'll need to figure out where the data is today. A fast internet connection that can be left unattended is very helpful so a desktop is much easier to use than a laptop in a coffee shop in this case. The private, non-government data (i.e. open street map data) was fairly straightforward to find. The openstreetmap importer (osm2pgsql) can handle the compressed format (I believe) so leave Planet.osm compressed .pbf format to save hard drive space. This project will need plenty.

The government data was much harder to source as it seems like they are constantly changing file formats and locations. I see that there is some newer work that eliminates this problem.

All of the stream and river data is held in NHD shapefiles. However the data isn't currently released as a shapefiles. Look here for shape files. The data was in a 4 dimensional zm format so you will need to convert it to 2 dimensions to get mapnik to recognize it. The postgis command ST_Force2D worked for me.

The NLCD has since released a 2011 version of the 2006 data. The data is not a tif, but I found a copy here If this link is broken, browse to the server and see if you can find a new link.

The topography data is in 1/3 arcsecond DEM .tif files (I spent some time looking for 13 arcsecond data). n35w109.tif means that the data contains a 1 latitude x 1 longitude of data, with n 35 w 109 in the NorthWest corner. The USGS is hiding their open ftp servers. Use the national map viewer to download one of the these files. When they e-mail you the link, they reveal the ftp location. The format is in .img so use gdal_translate -of GTiff C:\temp\input\a.img C:\temp\output\a.tif to convert the data to a geotiff.

Configuring the Rendering Environment

Here's how I had my geodata folder organized. Make sure to get the right filenames and formats.

colormap  hillshade  hypsorelief  ned13  NHD  nlcd2006  osm

./colormap:

./hillshade:

./hypsorelief:

./ned13: n32w109.tif  n35w108.tif  n36w109.tif  …..

./NHD: nhdarhi_10l.dbf  nhdflh_11.dbf    nhdlihi_13.shp   nhdpthi_16.shp nhdarhi_10l.prj  nhdflh_11.prj    nhdlihi_13.shx   nhdpthi_16.shx nhdarhi_10l.shp  nhdflh_11.shp    nhdlihi_15.dbf   nhdpthi_17.dbf nhdarhi_10l.shx  nhdflh_11.shx    nhdlihi_15.prj   nhdpthi_17.prj nhdarhi_10u.dbf  nhdflh_13.aih    nhdlihi_15.shp   nhdpthi_17.shp nhdarhi_10u.prj  nhdflh_13.ain    nhdlihi_15.shx   nhdpthi_17.shx nhdarhi_10u.shp  nhdflh_13.dbf    nhdlihi_16.dbf   nhdwbhi_10l.dbf nhdarhi_10u.shx  nhdflh_13.prj    nhdlihi_16.prj   nhdwbhi_10l.prj nhdarhi_11.dbf   nhdflh_13.shp    nhdlihi_16.shp   nhdwbhi_10l.shp nhdarhi_11.prj   nhdflh_13.shx    nhdlihi_16.shx   nhdwbhi_10l.shx nhdarhi_11.shp   nhdflh_15.dbf    nhdlihi_17.dbf   nhdwbhi_10u.dbf nhdarhi_11.shx   nhdflh_15.prj    nhdlihi_17.prj   nhdwbhi_10u.prj nhdarhi_13.aih   nhdflh_15.shp    nhdlihi_17.shp   nhdwbhi_10u.shp nhdarhi_13.ain   nhdflh_15.shx    nhdlihi_17.shx   nhdwbhi_10u.shx nhdarhi_13.dbf   nhdflh_16.dbf    nhdpthi_10l.dbf  nhdwbhi_11.dbf nhdarhi_13.prj   nhdflh_16.prj    nhdpthi_10l.prj  nhdwbhi_11.prj nhdarhi_13.shp   nhdflh_16.shp    nhdpthi_10l.shp  nhdwbhi_11.shp nhdarhi_13.shx   nhdflh_16.shx    nhdpthi_10l.shx  nhdwbhi_11.shx nhdarhi_15.dbf   nhdflh_17.dbf    nhdpthi_10u.dbf  nhdwbhi_13.aih nhdarhi_15.prj   nhdflh_17.prj    nhdpthi_10u.prj  nhdwbhi_13.ain nhdarhi_15.shp   nhdflh_17.shp    nhdpthi_10u.shp  nhdwbhi_13.dbf nhdarhi_15.shx   nhdflh_17.shx    nhdpthi_10u.shx  nhdwbhi_13.prj nhdarhi_16.dbf   nhdlihi_10l.dbf  nhdpthi_11.dbf   nhdwbhi_13.shp nhdarhi_16.prj   nhdlihi_10l.prj  nhdpthi_11.prj   nhdwbhi_13.shx nhdarhi_16.shp   nhdlihi_10l.shp  nhdpthi_11.shp   nhdwbhi_15.dbf nhdarhi_16.shx   nhdlihi_10l.shx  nhdpthi_11.shx   nhdwbhi_15.prj nhdarhi_17.dbf   nhdlihi_10u.dbf  nhdpthi_13.aih   nhdwbhi_15.shp nhdarhi_17.prj   nhdlihi_10u.prj  nhdpthi_13.ain   nhdwbhi_15.shx nhdarhi_17.shp   nhdlihi_10u.shp  nhdpthi_13.dbf   nhdwbhi_16.dbf nhdarhi_17.shx   nhdlihi_10u.shx  nhdpthi_13.prj   nhdwbhi_16.prj nhdflh_10l.dbf   nhdlihi_11.dbf   nhdpthi_13.shp   nhdwbhi_16.shp nhdflh_10l.prj   nhdlihi_11.prj   nhdpthi_13.shx   nhdwbhi_16.shx nhdflh_10l.shp   nhdlihi_11.shp   nhdpthi_15.dbf   nhdwbhi_17.dbf nhdflh_10l.shx   nhdlihi_11.shx   nhdpthi_15.prj   nhdwbhi_17.prj nhdflh_10u.dbf   nhdlihi_13.aih   nhdpthi_15.shp   nhdwbhi_17.shp nhdflh_10u.prj   nhdlihi_13.ain   nhdpthi_15.shx   nhdwbhi_17.shx nhdflh_10u.shp   nhdlihi_13.dbf   nhdpthi_16.dbf nhdflh_10u.shx   nhdlihi_13.prj   nhdpthi_16.prj

./nlcd2006: This is actually NLCD 2011 data. nlcd2006.tif

./osm: ne_10m_populated_places.cpg ne_10m_populated_places.dbf ne_10m_populated_places.prj ne_10m_populated_places. ne_10m_populated_places.shp ne_10m_populated_places.shx ne_10m_populated_places. ne_110m_admin_0_boundary_ ne_110m_admin_0_boundary_ ne_110m_admin_0_boundary_ ne_110m_admin_0_boundary_ ne_110m_admin_0_boundary_ ne_110m_admin_0_boundary_ Planet.osm shoreline_300.dbf shoreline_300.index shoreline_300.shp shoreline_300.shx water_polygons.cpg water_polygons.dbf water_polygons.prj water_polygons.shp water_polygons.shx world_boundaries

./osm/world_boundaries: builtup_area.dbf    places.shp         world_boundaries_m.dbf builtup_area.index  places.shx         world_boundaries_m.index builtup_area.prj    world_bnd_m.dbf    world_boundaries_m.prj builtup_area.shp    world_bnd_m.index  world_boundaries_m.shp builtup_area.shx    world_bnd_m.prj    world_boundaries_m.shx places.dbf          world_bnd_m.shp places.prj          world_bnd_m.shx