logo separator

[mkgmap-dev] Sea generation

From Adrian ar2988-os at yahoo.co.uk on Sun Nov 14 00:40:31 GMT 2010

On 5/11/2010, Charlie Ferrero wrote:
> One improvement would be for the --generate-sea:mp version to imitate
> the non-mp version in that a land polygon is generated to overwrite
> the ugly Garmin yellow base colour.
>
> This is the only issue stopping me from switching to --generate-sea:mp

I have produced a modification for mkgmap. It creates a land polygon
covering each tile, when you are using the option
--generate-sea=multipolygon. The tag of the land polygon is set in the
same way as for the no-mp option. Note: Felix has reported that doing
this, slows down redrawing of the screen. For that reason, he recommends
against this approach. I was not sure whether you wanted a land polygon
over the whole tile, or only over the actual land area. The latter would
be more difficult, and I'm not a Java programmer. Perhaps my
modification will do as a temporary fix. If you do not specify a land
polygon type in the style file, the modification should have no effect.

I will go into more detail than you may need, in the hope that it will
be helpful to less expert readers.
Download the source, e.g. mkgmap-r1728.src.tar.gz
Unpack the file, to produce the directory, e.g. mkgmap-r1728
Use a text editor to open the file
mkgmap-r1728/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java
After line 148, [Coord se = new Coord(maxLat, maxLong);] insert

		if (generateSeaUsingMP) {
			/*
			 * Add a land polygon covering the tile
			 */
			long landId = FakeIdGenerator.makeFakeId();
			Way land = new Way(landId);
			land.addPoint(nw);
			land.addPoint(sw);
			land.addPoint(se);
			land.addPoint(ne);
			land.addPoint(nw);
			land.addTag(landTag[0], landTag[1]);
			saver.addWay(land);
		}

I have seen strange things happen to text in e-mails, such as tabs being
converted to spaces, and leading blanks being suppressed. Each of the
lines above starts with either two tabs or three tabs. So I have also
attached a file containing the same block of code. (But the last time I
sent a text attachment, it appeared on the mailing list web site with a
.pl extension and with all the line-endings removed!) If your text
editor cannot handle Unix line-endings, you may need to use unix2dos and
dos2unix.

Having saved the file, change to the directory mkgmap-r1728, and compile
mkgmap by entering
ant dist
at the command line.
(Note for Mac OS 10.5 Leopard. You need 64-bit Intel hardware to run
Apple's Java v1.6. To get ant to use Java v1.6, change the symbolic link
CurrentJDK in /System/Library/Frameworks/JavaVM.framework/Versions to
point to 1.6 instead of 1.5. Changing the preferred version of Java in
the Java Preferences utility will not do the trick. You may need to redo
the change to the symbolic link after a Java update.)
If you need to rerun the compilation after fixing a problem, sometimes
it will not succeed unless you first issue the command
ant clean
The directory mkgmap-r1728/dist will contain what you would normally
download as mkgmap-r1728.zip or mkgmap-r1728.tar.gz. The jar file will
be at mkgmap-r1728/dist/mkgmap.jar

I discovered while testing, that the restriction on short option names
in the configuration (.args) file, also applies to input files. If you
just put a file name in the .args file, it will be silently ignored. You
have to put e.g. input-file:white.TYP

I would have liked to make this work also when you are not using
--generate-sea, but I could not see how, because method end() of class
SeaGenerator is not invoked when you are not using --generate-sea. If
you try to insert similar code into method init(...), which *is* always
invoked, you find that saver.getBoundingBox returns default values - it
has not yet been set up to correspond to the map.  As a workaround for a
land-only map, you could use my modified version of mkgmap, with
--generate-sea=multipolygon, and use a custom style with the line
natural=sea [0x32 resolution 10]
removed from the polygons file, in order to avoid any possible problems
with flooding. For a map with a coastline, this workaround will not give
you a coastline way drawn on a white background.

To get a white background, you need to use a custom style and a custom
.TYP file. The style needs to contain a line such as
natural=land [0x010100 resolution 16]
in the polygons file. The .TYP file needs to specify the colour of
polygon type 0x010100 (or whatever you have chosen). There is a good
description of how to construct a .TYP file in the cGPSmapper manual
http://cgpsmapper.com/download/cGPSmapper-UsrMan-v02.5.pdf
There is a good online .TYP file creator/editor at
http://ati.land.cz/gps/typdecomp/editor.cgi
You will not need this for making a white background, but details of the
Garmin colour palette are here
http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2010q1/007419.html
Details of what you need to do for certain, particularly recalcitrant
GPS receivers, are here
http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2010q1/006929.html
Pay attention to the drawing order, to placeholders; make sure that the
family-id in your .TYP file matches the family-id of your map. The land
should be at drawing order 1 and the sea at drawing order 2. To include
the .TYP file in your map, add it to the list of input files to mkgmap.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mod.java
Url: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20101114/0667e8a8/attachment.pl 


More information about the mkgmap-dev mailing list