
I played with an similar thing some time ago, a year or so. My algorithm was not searching for the biggest city, but counted the 'is_in' tags of the osm data. The idea behind it was that should scale with different resolutions. With big tiles it should name the tiles with the names of boundaries, if I break it down into small tiles it should take the names of the cities and villages. With statistical probability in a big city exists much more is_in tags as in a small village. This was inedependent of the geonames service and fully based on the osm data. As far as I can remind, the results worked in general, but the code does not fit well into the splitter. I would have to search on my harddrive, if the code lays around somewhere. Regards, Johann Clinton Gladstone schrieb:
estI 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. _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev .