PyTopo is a Python-gtk script which interprets local map data (for instance, from a Topo! data CD), and displays it in an interactive viewer, where you can scroll to adjacent maps, switch between resolutions, or produce a map image for printing or editing.
Why does PyTopo exist? There were several existing Linux mapping applications which take data from online web sites or roads databases, and others which take GPS data and correlate it with maps; but I couldn't find an app which would display data for any location, without requiring a GPS, using local image map sources.
The current version of PyTopo is 0.7.
PyTopo 0.7 added a -c argument to find the center of a new map
collection (helpful if you're making your own collections --
sometimes finding the initial coordinates is difficult).
It also had a minor bugfix for a problem displaying maps where
either latitude or longitude is less than 10 degrees.
PyTopo 0.6 fixed a memory leak from PyTopo 0.5.
PyTopo starting with 0.5 can read several other map formats, can display to a
window of arbitrary size, and has a few other bug fixes (as well
as much cleaner, more maintainable code). It does require that you
change your ~/.pytopo file slightly if you were using a version
prior to 0.5: see the comments at the
beginning of the script for examples, or check out my
preliminary documentation.
Please report any bugs you find!
Download PyTopo 0.7.
Begin by creating a file named .pytopo in your home directory, in which you define a list of named coordinates, and specify some other parameters such as location of the map data and preferred window size. Read the comments at the beginning of the pytopo script for samples of the .pytopo file.
| Left, Right, Up, Down | Scroll the map in the indicated direction. |
|---|---|
| +/=, - | Zoom in to the 7.5 minute series, or out to the 15 minute series. (Zooming isn't supported in other map formats yet.) |
| s | Save the current map to a file under $HOME/Topo |
| Space | Print (to standard output) the current coordinates of map center. |
Clicking in the map displays the coordinates of where you clicked, as well as the distance and bearing from the last clicked point.
PyTopo assumes that you already have maps locally, on disk or CD, in a supported image format, named according to the Topo! naming conventions. (PyTopo 0.5 adds support for other naming conventions as well.)
The Topo! local area and specific park map packages sold in camping/hiking stores (sometimes under the aegis of National Geographic) are reasonably priced as a source of map data. They come with Windows software, but Linux users can ignore the software and use the data files, which are standard GIF, named in a fairly straightforward way. They're a good source of US map data.
Caution: the Topo! Back Roads Explorer and the statewide explorer collections are not in this friendly format. They use large data files in a proprietary ".tpq" format. Tom Trebisky has analyzed the format and has written an extractor, and he also has a C GTK viewer for this format. (Eventually I hope to integrate direct support for them into pytopo as well.)
Just to be clear: I am not distributing map data.
You can buy map bits directly from the USGS, but they have a hefty setup fee so it's not cost effective unless you're buying quite a lot.
For some areas, you can download topo maps; for instance, for California you can get maps in TIFF format from the California Spatial Information Library. You still have to split up the maps into maplets, though; if you have ImageMagick, you can use a command like
convert input-map.jpg -rotate 90 -crop 262x328 -trim -repage +0+0 out-map%02d.jpgA map split this way can be read with PyTopo 0.5 or later. Maps downloaded as PDF (such as USGS geologic maps) must be converted to a raster format before splitting, using a command such as
gs -sDEVICE=jpeg -r300 -sOutputFile=output-map.jpg input-map.pdf
PyTopo users may be interested in two helper scripts, which use the montage program from ImageMagick to coalesce the small Topo! maplets into a larger map which can be manipulated or printed with a program such as GIMP. These are straight command-line programs, with no UI, and do not require pygtk.