logo separator

[mkgmap-dev] [Alpha PATCH] Lookup names for sea polygons

From Clinton Gladstone clinton.gladstone at googlemail.com on Sat Feb 26 18:55:08 GMT 2011

The attached patch is a highly alpha version of code which attempts to determine the ocean or sea name of generated sea polygons.

- The code uses a web service from geonames.org (see http://www.geonames.org/export/web-services.html#ocean)

- The results can sometimes be wildly inaccurate. :-)

What you need:

1. To use this, you must first create a free user account at geonames.org, and activate that account for the free web services. (http://www.geonames.org/login)

2. Then you must specify your user name with the "geonames-user" parameter in mkgmap's --generate-sea option. Example:

   --generate-sea=multipolygon,extend-sea-sectors,close-gaps=1000,floodblocker,geonames-user=<your user name>
  (Replace "<your user name>" with your geonames.org user name.)

3. For the moment, this only works with multipolygon sea generation, although this can be changed later.

How it works:

For each sea polygon, the code makes one or more HTTP calls to http://api.geonames.org/oceanJSON and uses the first sea name found.

Example HTTP call:


The code attempts lookups for the following coordinates in the following order. :

1. The center of gravity of the first way in the multipolygon.

2. The first coordinate in the first way in the multipolygon.

3. - 6. The corners of the bounding box.

7. The center of the bounding box.

The code uses the first valid name found (and skips the other lookups).

The result:

If everything works nicely, and you are lucky, you'll get nice named sea polygons.

However, in most cases, you'll get semi-accurate results. Often only one sea (multi-)polygon is created per tile. Polygons which cross sea borders will only have the name of the first sea found. For example, in the attached screen shot of the coast of South Africa, you can see that the South Atlantic Ocean extends too far to the East.

As such, the results can be considered to be of entertainment value only. :-)

I would appreciate your feedback though, especially if you have ideas to improve this. 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cg-ocean-names-trunk-1862-v0.patch
Type: application/octet-stream
Size: 6810 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20110226/aae0ff4d/attachment.obj 
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sea.png
Type: image/png
Size: 43049 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20110226/aae0ff4d/attachment.png 

More information about the mkgmap-dev mailing list