Hack 54. Create Your Own Maps for a Garmin GPS

The base maps and purchasable maps for a Garmin GPS are nice, but sometimes you really want your own maps.

When you buy a map-capable Garmin GPS, it comes with a base map that's helpful for long-distance navigation but doesn't have much detail. Garmin and others are happy to sell mapsat least for some parts of the worldthat have more detail, but that's not always a perfect solution either. If you fall into any of these categories, you may have a good reason to make your own maps for the GPS:

  • You're visiting a temporary location, which has its own geography for a brief period of time. The Burning Man festival and military encampments are two wildly divergent examples. Even a large permanent camp may not be on many maps if it's on private property.
  • You need data that just isn't available through commercial GPS map providers. You might want to know where known toxic waste dumps are, which areas in a forest are inhabited by particular birds, boundary lines for tax parcels in your neighborhood, the crops in particular fields, or where the bars and restaurants are that a particular reviewer found good.
  • You want to personalize your map data and possibly share it.

There are a number of tools available for creating maps on these devices and uploading the maps to your GPS. Many of the tools for creating maps have free versions and commercial versions, while uploading is generally done with either sendMap, described here, or Garmin's commercial MapSource tool, which comes with their map products. Sadly for Macintosh and Linux users, many of these tools are Windows-only.

There are a number of different applications available for creating Garmin GPS maps, but this hack uses GPSMapEdit, available from http://www.geopainting.com/. GPSMapEdit is shareware; you can try it out and use it for free, but the author requests 44 Euros or $54. Source code is also available if you want to tinker, though it isn't under an open source license. GPSMapEdit lets you import data from a number of sources, create your own map objects, and save the maps in a standard text format. With the installation of another free program, cGpsMapper (http://cgpsmapper.com/), GPSMapEdit can produce maps in the IMG format used by Garmin GPS devices. The creator of cGpsMapper also provides a program called sendMap, which will let you put your maps on the GPS device. I recommend Version 2.0.

For my first map, I started by importing a shapefile derived from TIGER census data. While it's just roads, it gives me much more detail than the base map in the receiver. I got the file from the same repository that was used for [Hack #65]. To bring a county's worth of roads into GPS format, I went to File images/ent/U2192.GIF border=0> Import images/ent/U2192.GIF border=0> ESRI Shape (*.shp) in the GPSMapEdit program. After the file dialog box to select the shapefile, the program asked me what kind of objects I was importing, as shown in Figure 5-12.

Figure 5-12. Choosing an object type

There are two ways to select objects here. The blunt way, shown on the first tab, is to pick a type of GPS map object for everything in the file. (If there are different kinds of objects in the filepolylines, polygons, etc.you can pick one type of GPS map object for each type of object in the shapefile.) The smart way, on the second tab, lets you pick a field in the data underlying the shapefile, though that field has to specify the type for each object using the Garmin numbering. For my purposes, calling everything an "Arterial road, thin" street is okay, if not ideal. When I have time, I'll go back and get it right.

The next step, shown in Figure 5-13, is to choose a source for label information, again from the data included in the shapefile. It only lets you pick one column, which is frustrating. Again, you could create a shapefile that includes the road name as one column rather than as parts split across three columns.

Figure 5-13. Choosing a label source

After you've chosen a label source, GPSMapEdit shows you some basic geographic information derived from the file, as shown in Figure 5-14. You can't change much of the information here, but it's definitely an opportunity to sanity-check. Do the latitude and longitude boundaries look right? If you have a map that wasn't projected right, these numbers will likely be very wrong. The changes you can make on this page are limited by the coordinate system of the underlying data. Make sure the datum is set correctly. The first time I imported a WGS84 map, I left the datum set to Zaperij, and my map was consistently wrong by a few hundred yards. That was no big deal when I was on the highway, but horribly confusing in a residential neighborhood.

Figure 5-14. Setting the source coordinate system

When in doubt, stick with the WGS84 datum, which is what the GPS satellites themselves use.

The last option, shown in Figure 5-15, lets you choose which zoom levels to import. You can add additional zoom levels later if you need, through the Levels tab of File images/ent/U2192.GIF border=0> Map Properties.

Figure 5-15. Choosing zoom levels for import

When you click Finish, you'll see something like Figure 5-16, displaying the data just imported from a very high-level view.

Figure 5-16. Freshly imported map

Zooming in on the map will show you the road system, complete with road-name labels imported from the shapefile (see Figure 5-17).

You can make changes to the map with GPSMapEdit's tools, which will let you add objects as you deem appropriate. When the map is ready, you'll need to save a copy at this point in the Polish format (*.mp), which is GPSMapEdit's native format and the base that the cgpsmapper program uses to generate the binary files that go into the GPS.

Polish format is a text-based format, so if you want to generate these files directly from other tools, you can do that. Documentation is available at http://plrecgps.pp.org.pl/bin/view/GPS/PFMsyntaxDescr.

Before you can turn this data into a map, you need to assign it a name and an ID, using the Header tab at File images/ent/U2192.GIF border=0> Map Properties, as shown in Figure 5-18.

The ID value should be unique, at least among the maps you'll be uploading to the device, and a meaningful name will help users later. Once you've done this, you can safely export the map to Garmin's binary IMG format. To save the map in the Garmin IMG format, you'll need to select File images/ent/U2192.GIF border=0> Export images/ent/U2192.GIF border=0> Garmin IMG / cgpsmapper.exe. When you choose this option, GPSMapEdit will ask you where cgpsmapper is located and will then present you with a dialog box for overseeing the export. After you click the Run button, GPSMapEdit will call cgpsmapper, which will process the file for a while and produce a report like that shown in Figure 5-19.

Figure 5-17. Freshly imported map, close up

Figure 5-18. Setting the name and ID for a map

Figure 5-19. Report on export

Now that you have an IMG file, connect your Garmin GPS to the computer. You can drop the file on the sendmap20 program icon or run sendmap20 from the command line as shown here:

C:ORAgpssendmap20>sendmap20 tompkins3.img
Sendmap2.0 by gps_mapper, kozicki@cgpsmapper.com
Trying: usb
Trying: com1
Detected : eTrex Vista Software Version 3.40
Available memory : 25149440
Max number of maps: 525
Map uploaded!

Uploading sometimes takes a few attempts. I regularly get a "Couldn't change speed" error, but it always goes away after a while. Remember to set the interface on your Garmin receiver to Garmin mode. NMEA mode will not work!

You may have to tell the device to use the map you've added, but as Figure 5-20 shows, the map is now installed and ready for use.

Figure 5-20. The created map, seen in a Garmin eTrex Vista

If you want to use Garmin's MapSource program to upload maps you created yourself, visit http://www.keenpeople.com/index.php?option=articles&task=viewarticle&artid=4&Itemid=3 for a description of a registry hack that will let MapSource work with your maps.

 

5.10.1. Hacking the Hack

Using other people's data to create maps is great, but sometimes you'll need to use your own. To put a map of a small trail into my GPS, I hiked the trail, pulled my tracklog out with MapSource, saved it to a file, and then opened that file in GPSMapEdit. The tracklog looked like Figure 5-21.

To turn this into a trail, I shift-clicked on both parts of the log (the GPS lost satellite at one point), then right-clicked to bring up a menu. I chose Convert To images/ent/U2192.GIF border=0> Polyline. I picked "0x0016 Trail" from the list of possible types, shown in Figure 5-22, and GPSMapEdit created a trail on top of the tracklog.

The tracklog is still there, though; I had to cut the trail to reach the tracklog and delete it. After doing that, and selecting Modify images/ent/U2192.GIF border=0> Label from the right-click context menu to change the name, I had the trail map shown in Figure 5-23.

Putting this map onto a GPS requires a few more steps, all of them under Map images/ent/U2192.GIF border=0> Properties. First, set an ID and a name as described earlier and shown in Figure 5-18. Then, go to the Levels tab to identify at which zoom levels this map should be shown. Clicking the "Insert Before" button will add two default zooms, though it's probably a good idea to change them (with the Change button) to something more like those shown in Figure 5-24.

Once this is set, save the file, export it to an IMG, and upload it to the device just like you did before. As shown in Figure 5-25, the new map will integrate itself with the earlier map just perfectly in the device.

You can take this to much greater lengths, of course, and there are a variety of software packages, many of them free or shareware, available to help. For a partial list, see http://www.keenpeople.com/index.php?option=com_downloads&Itemid=50&func=selectcat&cat=2.

Simon St.Laurent

.

Figure 5-21. A tracklog, as viewed in GPSMapEdit

Figure 5-22. Choosing an object type for the polyline representing a trail

Figure 5-23. The tracklog in its new life as a trail

Figure 5-24. Setting zoom levels for the trail

Figure 5-25. The Monkey Run Trail and Tompkins County Roads maps shown at the same time in the GPS


Mapping Your Life

Mapping Your Neighborhood

Mapping Your World

Mapping (on) the Web

Mapping with Gadgets

Mapping on Your Desktop

Names and Places

Building the Geospatial Web

Mapping with Other People



Mapping Hacks
Mapping Hacks: Tips & Tools for Electronic Cartography
ISBN: 0596007035
EAN: 2147483647
Year: 2004
Pages: 172

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net