Mkgmap/help/custom

From OpenStreetMap Wiki
< Mkgmap‎ | help
Jump to navigation Jump to search

Customising the map

You can completely change which features are displayed and at what zoom levels.

First you need to understand a little about the way that the zoom works in Garmin maps. There are two concepts 'resolution' and 'level'.

The Garmin Map

Each Garmin map may contain several separate maps which are prepared at different 'levels' of detail, the most appropriate of these is displayed depending on the zoom selected by the user.

When creating the map, the map maker will choose which of these 'level' maps is displayed according to the 'resolution' (or zoom) selected. For example, a map might contain three levels (0, 1 & 2); On the level 2 map (showing the largest area) a town might just be represented by a named dot; as the user zooms in, the display might switch to the level 1 map showing an outline of the town. Zooming in further might switch to the level 0 map, with the individual streets of the town shown.

In addition the GPS itself might decide when to show or hide individual features in each of the 'level' maps, especially with POIs. This is also affected by the 'detail' setting in the map config menu.

Resolution

The first is 'resolution' this is a number between 1 and 24 with 24 being the most detailed resolution and each number less is half as detailed. So for example if a road was 12 units long at resolution 24 it would be only 6 at resolution 23 and just 3 at resolution 22.

On a Legend Cx the resolution corresponds the these scales on the device:

Resolution Scale on device
16 30km-12km
18 8km-3km
20 2km-800m
22 500m-200m
23 300m-80m
24 120m-50m

It may be slightly different on different devices. There is an option to increase or decrease the detail and if you change that from 'Normal' then it will change the values above too.

Level

The next is 'level'. This is a number between 0 and 16 (although perhaps numbers above 10 are not usable), with 0 corresponding to the most detailed view. The map consists of a number of levels starting (usually) with 0. For example 0, 1, 2, 3 and a different amount of detail is added at each level.

The map also contains a table to link the level to the resolution. So you can say that level 0 corresponds to resolution 24.

This mapping is specified in the file 'options' within the style directory in use. You can also specify it on the command line, for example:

 --levels=0:24,1:22,2:20

This means that the map will have three levels. Level 0 in the map will correspond to resolution 24 (the most detailed), level 1 will show at resolution 22 (between scales of 500m and 200m) and so on. The lowest level needs to include at least an object, therefore the default lowest level of 16 will create a broken map, if your osm input file has no information at zoom level 16 or lower included.

Watch out with levels when building topographical maps

According to the principle that a map is never allowed to have an empty layer, if you have two input files for mkgmap, you have to specify --levels for each input file. This is especially important when one of the input files consists exclusively of contour lines. Take the following command as example on how to create such a map. (Attention the line wrap is only here for the wiki, this has to be one command in cmd.exe or terminal)

java -jar mkgmap.jar --style-file=D:\path\to\mkgmap\resources\styles\style_name\ 
--levels=0:24,1:22,2:20,3:18,4:16,5:14,6:12,7:10 data.osm 
--levels=0:24,1:22,2:20 srtm.osm

This would assume that your contour lines are in layer 24 (minor), 22 (medium) and 20 (major) and your normal osm data spread between 24 and 10. If you don't adhere to proper levels you will get problems with the map not displaying at lower zoom levels, not displaying at higher zoom levels or not displaying at all (you'll only see the background polygon 0x4c).

There are 2 alternatives to circumvent having to assign different levels on compile.

a) Introduce dummy objects at the lowest level into your map. A POI in the lowest level per input file is enough.
b) Merge your osm files (either by script or in text editor (text editor may crash though on opening huge .osm files), and then use the lowest resulting level.

Concluding the easiest is to include dummy objects at lowest level. (it should be thought about mkgmap doing this by default). The lower your lowest level the later the basemap will exchange your osm map. Your lowest level object is the defined by the object with the lowest level (as defined in your style) actually present in your osm input file.

The map features file

Note: map features file is deprecated. Styles are used instead. Styles are stored in directories within mkgmap/resources/styles directory. They must contain several files, defining points, lines and polygons included in the map and how they are represented along with other files. See default style for reference and Mkgmap/help/Custom_styles for more information.

Take a look at the map-features.csv file in the resources directory of the mkgmap distribution. It may be easier to edit it in a spreadsheet program. An other example-file: cycling-map-features.csv from svn of garmincyclemap

A typical line may look like this:

point|amenity|grave_yard|0x64|0x03|23
  • Column 1 is point, polyline or polygon, depending on whether the feature is a point of interest, a line feature such as a road or an area such as a park.
  • Columns 2 and 3 are taken exactly from the key and value columns from the map features page.
  • Column 4 is the garmin code that you want to use.
  • Column 5 only applies to points and also determines the type of the object. The file garmin_features_list.csv (also in the resources directory) has a list of all the values that I know.
  • Column 6 is the minimum resolution at which this feature will appear. So in the example here where the resolution is 23 and we had
   --levels='0:24,1:22'
it would show only at level 0. If instead we had:
   --levels='0:24,1:23'
it would show at both level 0 and level 1.