Oct
14
2007

How to create custom Garmin maps part3

Tutorial 1b – Generating Contours

In this tutorial we will use the downloaded Elevation Data to create topographic contour lines for Jackson.

By convention, printed topographic maps use thick lines to represent ‘Index Contours’, medium lines to represent ‘Intermediate Contours’, and dashed lines to represent ‘Supplementary Contours’. GM8 supports this convention.

In the Overlay Control Center, right-click on JACKSON WY.GMG and select Zoom to Selected Layer(s) to fill the screen with our topographic data, then close the Overlay Control Center.

Go to File | Download Online Imagery/Topo Maps, and select the ‘DRG – USGS Digital Raster Graphics (Topographic Maps) option, with Current Screen Bounds as the Area to Download. GM8 will retrieve a scanned topographic map of our area of interest and add it as an overlay in our workspace.

Note that the thick, labeled contour lines are spaced every 200’ at 6400’, 6600’, and 6800’. By convention, USGS maps have four intermediate contour lines between each index contour or major contour line. In this area, the intermediate contours are spaced at 40’. There are slight differences in the ways that contour lines are named, but they are all equivalent.

USGS GM8 cGPSMapper
Index Contour Contour line, Major

Land Contour (thick)

Type=0×22

Intermediate Contour Contour line, Intermediate

Land Contour (medium)

Type=0×21

Supplementary Contour Contour line, Minor

Land Contour (thin)

Type=0×20

Let’s use GM8 to generate contours matching the USGS topographic map.

We want our intermediate contours to fall at 40’ spacing. Click File | Generate Contours… change Contour Interval to 40’, and uncheck the ‘Append Unit Labels (‘m’ or ‘ft’) to Elevation Labels’ checkbox.

Click OK. GM8 generates the contour line set every 40’, with intermediate and major contours alternating every 200’ closely matching the USGS map.

Advanced User Tip: To toggle the display of the vertices, press Shift+V.

Exporting our combined data set

When we generated the topographic contour lines, GM8 created a new overlay called GENERATED CONTOURS. This is a vector overlay, just like our USER CREATED FEATURES overlay. Vector overlays (Points, Lines and Areas) are the only data that can be compiled by cGPSMapper and downloaded to your GPSr. Raster overlays (like the USGS elevation map, or the TerraServer aerial imagery) is only used for reference when digitizing, or making printed maps.

We now have two vector layers –USER CREATED FEATURES, with our roads, points and areas, and GENERATED CONTOURS, with our topographic contour lines. Let’s do another export for compilation. Open the Control Center, and hide the non-vector layers – JACKSON WY.GMG, JACKSON WY.TIF, and TERRASERVER DRG (JACKSON, WYOMING, UNITED STATES).

We are now seeing only the data that we’ve created for our map. It is not necessary to hide the raster layers when exporting, but it’s a good habit to get into to be sure that what you’re exporting is what you want in your data file. Your screen should look something like this:


From the menu, select File | Export Vector Data | Export Polish MP (cGPSMapper) file, and specify JACKSON WY as the Map Name, then select JACKSON WY.MP as the filename, and click OK. GM8 will ask you to confirm that we are overwriting the previous version of the file. Click OK.

Double-click your MAKE JACKSON WY.BAT file to invoke cGPSMapper to compile our latest source file. Notice that it takes a bit longer to process the contour lines.

Download the .IMG file to your GPSr using SendMap20, and enjoy the fruits of your labor.

Tutorial 2a – Controlling Object Visibility

Goals for this section

- A first look at Polish format source code

- Understanding object visibility

- Creating a Template File

To this point, we have been working with general defaults in creating our map. You now know enough of the basics that if you want to start working on your own map, you can now do so. The following tutorials in this document discusses Object Visibility, Custom Types and Routing. You can come back to rejoin the tutorials at any time – nothing we introduce subsequently will cause you to create or manage your data differently.

A First Look at Polish Format

As you now know, Polish format (.MP files) is the name for the source code that cGPSMapper converts to Garmin executable format (.IMG). Historically, it’s called Polish format because the author of cGPSMapper is from Poland, and when you write a great program like cGPSMapper, you get to name things.

An .MP file can be very simple, with a single Point object declaration, or it can be very complex, with thousands of object declarations. For a full description of cGPSMapper compiler functions, go to the cGPSMapper website for the latest documentation at http://cgpsmapper.com/manual.htm.

At a minimum, an .MP file has a header declaration, which tells the compiler a few basic things about our map, and one or more object declarations. Declarations in Polish format are always of the following form:

[declaration]

Attributes

[End-declaration]

When you tell GM8 to export a .MP file by using the File | Export Vector Data | Export Polish MP (cGPSMapper) File command, GM8 by default will create a header declaration, plus object declarations for your created features.

The default header generated by GM8 looks like this:

[IMG ID]

ID=423758661

Name=Jackson WY

Elevation=F

LBLcoding=9

Codepage=1252

Marine=N

Copyright=Mike Mapmaker

Preprocess=F

;TreSize=3000

POIIndex=Y

Transparent=N

Levels=4

Level0=24

Level1=22

Level2=20

Level3=18

Zoom0=1

Zoom1=2

Zoom2=3

Zoom3=4

[END-IMG ID]

For a full explanation of all the header declaration attributes, consult the cGPSMapper manual. For the purposes of this tutorial, we’ll look specifically at only a few lines dealing with object visibility.

Understanding Object Visibility

Note the lines from the [IMGID] header referencing Levels:

Levels=4

Level0=24

Level1=22

Level2=20

Level3=18

These lines tell cGPSMapper that our map will be defined with 4 levels of zoom detail. The lowest level, or smallest scale zoom, is Level0. ‘24’ refers to the precision of the latitude and longitude coordinates provided for the object. When declaring the location of objects in the world, the highest precision available uses 24 bits of resolution, which resolves to an accuracy of about 2.5 meters. Consumer GPS units have a best-case accuracy of about 8 meters. The header attribute of Level0=24 means that objects declared at level 0 will be stored with 24-bit accuracy, or a location of +- 2.5m.

Let’s look at how this works with the simplest object declaration, a Point declaration for the town of Jackson WY:

[RGN20]

Type=0×09

Label=Jackson

Levels=2

Data0=(43.480039,-110.7618274)

[END]

- [RGN20] begins an object declaration for a Point Feature.

- Type=0×09 is an attribute declaring that this Point Features is a ‘City, 10k-50k’.

- Label=Jackson corresponds to the name we provided when creating the Point Feature.

- Levels=2 means that the object will be visible for 2 zoom levels.

- Data0= tells cGPSMapper where in the world Jackson is located using its longitude (N/S) coordinate, followed by its latitude (E/W) coordinate. Coordinates in the western and southern hemispheres are negative, while coordinates in the northern and eastern hemispheres are positive. Data0 also asserts that this object is defined to exist at Level0 as its most detailed level, so cGPSMapper will store 24 bits of location information for this object’s coordinates.

- The [END] statement indicates that this object declaration is complete.

When cGPSMapper compiles this Polish format source code, it will create a pair of 24-bit coordinates for use when displaying objects at the most detailed zoom level, and a pair of 22-bit coordinates for use when displaying this object at Level1. This is significant because an object whose visibility spans multiple levels must have a coordinate pair in the data file for each level of visibility. By using less and less precision at the lower zoom levels, less storage space is required, making the file format more compact and efficient. cGPSMapper handles all of this for us during compilation, but it’s an important factor contributing to file size and map accuracy.

For our purposes in this tutorial, the key concept to grasp here is that GM8 is creating a default range of visibility for our objects, based upon the object type.

Controlling Object Visibility in the GPSr

If you’ve played with your GPS receiver, you know that you can influence how and when objects are displayed. Depending upon the Garmin model, there are settings in the menu associated with the map display page allowing you to increase or decrease map detail and whether or not certain object types are displayed, and how their labels are shown. These end-user controls are beyond the control of the mapmaker – there’s nothing we can do at map creation time that will override local settings that the user chooses at map display time. During map development, I recommend maintaining the default display settings for your reference GPSr so you have a pretty good idea of what the average user will experience.

Specifying Object Visibility in the Map Data

We can use GM8 and cGPSMapper to help us control how and when objects are displayed. GM8 automatically assigns default visibility attributes when you create objects. For example, Major Highways will be assigned a higher Levels= attribute than a Residential Road, meaning it will be visible at lower zoom magnification levels than residential streets.

Here is the exported Polish format code for Highway 89 in our map. Note the Levels=2 statement:

[RGN40]

Type=0×02

Label=89

Levels=2

Data0=(43.4745104,-110.7817081),(43.4749766,-110.7775745),(43.4751009,-110.7761759),(43.4755049,-110.7747152),(43.4775562,-110.7713897),(43.4787372,-110.7697424),(43.479421,-110.7684682),(43.4795764,-110.7680641),(43.4796696,-110.7674425),(43.4796696,-110.7623144),(43.4887526,-110.7623766),(43.4908894,-110.7618793),(43.495023,-110.7605429)

[END]

In this declaration for Broadway, note the Levels=1 statement:

[RGN40]

Type=0×06

Label=BROADWAY

Levels=1

Data0=(43.4796696,-110.7623144),(43.4796075,-110.7568909),(43.479723,-110.7544272),(43.479723,-110.7522714),(43.479723,-110.7499039),(43.4797615,-110.7431864)

[END]

Here’s our map zoomed to a scale of 0.3mi and 0.5mi:

As we zoom out to a scale of 0.5miles, Highway 89, the city dot and the major contour lines remain visible as Level 2 objects, but the city streets and minor contours – Level 1 objects — have disappeared.

GM8 knows all of the standard Garmin data types and how to assign the correct visibility attributes to each of them when creating your features, so for most mapmaking, you may never need to make changes to the default settings.

Using a Template File

The purpose of a Template File is to provide GM8 with a specific header that you want to in place of GM8 creating a header automatically for you at export time. There are several reasons you may wish to use your own header:

- Specifying your Map Name and Copyright so you don’t have to retype it each time you export

- Managing the Levels in your map

- Managing advanced attributes like Routing

We will create a Template File with GM8’s assistance, then use it to fill in our Map Name and Copyright automatically.

Using your text editor, open your exported JACKSON WY.MP.

Highlight the section from [IMG ID] through [END-IMG ID] at the beginning of the file, then press Ctrl-C to copy it to the Windows clipboard.

Create a new file, and paste the [IMG ID] header from the clipboard into the new file window.

In the ID= attribute, delete the number after the equal sign so that the line simply reads ID=. GM8 will automatically generate a unique number for each map created at export time, so there’s no need to specify a map ID number.

In the Copyright attribute, add your name.

Your Template File should now look something like this:

[IMG ID]

ID=

Name=Jackson WY

Elevation=F

LBLcoding=9

Codepage=1252

Marine=N

Copyright=Mike Mapmaker

Preprocess=F

;TreSize=3000

POIIndex=Y

Transparent=N

Levels=4

Level0=24

Level1=22

Level2=20

Level3=18

Zoom0=1

Zoom1=2

Zoom2=3

Zoom3=4

[END-IMG ID]

Save this file as \SAMPLE MAP PROJECT\HEADERS\JACKSON HEADER.MP, then exit your text editor.

Return to GM8. In the File menu, select File | Export Vector Data | Export Polish MP (cGPSMapper) File, bringing up the Polish MP Export Options dialog.

In the Template File section, click the checkbox to ‘Use Template MP File for Map Settings’. Press the Select File button to locate the JACKSON HEADER.MP file you just created in your \SAMPLE MAP PROJECT\SOURCE\HEADERS\ directory.

Click OK to export your file. Open it with your text editor, and confirm that your Map Name and Copyright attributes were transferred from your Template File.

An Important Note about Template Files created by GM8

We used GM8 to create our Template File, based on our currently defined Features. The Levelx= attributes were generated by GM8 as a function of the current object database. Different objects are visible up through different levels. For example, Interstate highways and oceans are visible several levels above State Highways or streams. If you make significant changes to your map, you will need to create a new template file to properly see your new features on your GPSr.

Written by admin in: |

No Comments »

RSS feed for comments on this post. TrackBack URL


Leave a Reply

You must be logged in to post a comment.

© 2006-2014 Vietnamese GPS | Digital Mobile Map | www.streetmapmobile.com | www.andgps.com