In order to use pytopo, you need to create a file called .pytopo in your home directory to tell pytopo where you keep your maps and what format they're in. There are also some other variables you can customize in that file.
A Collection is a set of maps from one source, all in the same format. For instance, if I load the Topo! Death Valley CD into a directory, that would represent one collection.
You must have at least one collection in order to use pytopo (otherwise it won't know where to look for your map data).
Define your collections like this:
Collections = [
Topo1MapCollection( "deathvalley", "/home/yourname/Maps/dvl_data",
7.5, 266, 328 ),
Topo2MapCollection( "kingscyn", "/home/yourname/Maps/kingscyn", "topo",
410, 256 ),
GenericMapCollection( "pa-geo", "/home/yourname/Maps/pa-geo-300",
"pa-geo-300-", ".jpg",
-122.497, 37.498, 300, 400, 10746, 13124,
2, True, False )
]
This defines three collections. The first one is called "deathvalley",
stored in the directory named /home/yourname/Maps/dvl_data,
and uses the format Topo1MapCollection -- the simple format used
in Topo! regional CD sets. The filenames already have latitude
and longitude encoded into them, but you do need to specify the size.
The second collection is a different sort of Topo! format, one with filenames beginning with "topo" and much wider and shorter jpeg images.
The third collection, called "pa-geo" and stored in /home/yourname/Maps/pa-geo, is more complicated. GenericMapCollection is a much more general format suitable for map collections you create yourself. Suppose a sample map in the collection might have a filename like pa-map-03-17.png. Then the pieces of the GenericMapCollection are:
| Field | Value | Description |
|---|---|---|
| Name | pa-geo | Name of the collection |
| Directory | /home/yourname/Maps/pa-geo | Directory where the files live |
| Prefix | pa-map- | Prefix prepended to every filename |
| Suffix | .png | Suffix (extension) appended to every filename |
| Longitude | 123 | Longitude of upper left corner |
| Latitude | 37.5 | Latitude of upper left corner |
| Width | Width of each maplet | |
| Height | Height of each maplet | |
| X scale | 10742 | X scale (pixels per degree) |
| Y scale | 13120 | Y scale (pixels per degree) |
| Num digits | 2 | Number of digits for each grid point in the filenames |
| Use dash? | True | Use a dash between X and Y grid point numbers in the file name? (E.g. pa-map-03-17.png vs. pa-map-0317.png.) |
| Latitude first? | True | Is the latitude the first grid point (e.g. 03) in the filename? |
Map Collections are simply Python classes. If you have a weird type of map collection and you know some Python programming, you can define your own map collection type inside your .pytopo file. If you write a collection class that might be useful to someone else, please send it to me and I'll include it in the next version of pytopo.
I'm working on a new format, using tiles downloaded from the OpenStreetMap project. Stay tuned for PyTopo 0.9!
Once you have one or more collections defined, you can start defining named sites which you can use as starting points when you run pytopo.
The format is:
[ sitename, longitude, latitude, collection_name ]Coordinates are in degrees.decimal_minutes.
Example:
KnownSites = [
# San Francisco Bay Area
[ "saratogagap", 122.0725, 37.155, "sfr" ],
[ "lexington", 121.594, 37.12, "sfr" ],
# Death Valley
[ "zabriskie", 116.475, 36.245, "deathvalley" ],
# From the Big Sur map:
[ "pinnacles", 121.0865, 36.3247, "bigsur" ],
]
You can customize pytopo by changing the values of these variables:
# Where to save generated maps. The default is fine for most people. MapSaveDir = os.environ["HOME"] + "/Topo/" Note: Saving maps may be buggy. I haven't tested it in quite a long time.
Adding more customizable variables to this file is another feature coming in version 0.9.