logo separator

[mkgmap-dev] Fun with splitter tile descriptions

From Clinton Gladstone clinton.gladstone at googlemail.com on Wed Sep 9 13:41:22 BST 2009

I found it somewhat annoying that my tiles always had identical
generic descriptions such as "OSM Map". It made it very difficult to
recognise which tiles belonged to which areas, in particular when
attempting to select specific tiles on my GPSr. Since my maps could
have over 200 tiles, it was tedious to add descriptive names manually.
To solve this, I performed the following small hack, which might be
interesting to others with a similar predicament:

- I created a Perl script which read the tile boundaries from the
areas.list file generated by splitter.

- For each bounding box, I called a webservice from GeoNames to
retrieve a list of populated areas (cities, etc.) within the tile.

- For each populated area within the tile, I called another webservice
to determine the population of that area.

- I determined the city with the largest population, and then wrote
the ISO country code and name of the city to the description parameter
in template.args.

To my astonishment, this worked rather well.

Here is an excerpt from the resulting template.args file:

[...]
mapname: 23000223
description: EE-Tartu
input-file: 23000223.osm.gz

mapname: 23000224
description: FI-Espoo
input-file: 23000224.osm.gz

mapname: 23000225
description: FI-Helsinki
input-file: 23000225.osm.gz

mapname: 23000226
description: RU-Saint-Petersburg
input-file: 23000226.osm.gz
[...]

A description of the webservices I used is at
http://www.geonames.org/export/ I used the GeoNames Perl client module
to parse the webservice results; this may not have been the most
efficient.

There are of course many other ways of doing this, and other services
and data which can be used. Perhaps this will inspire some of you to
create a better solution.

Cheers.



More information about the mkgmap-dev mailing list