Hi,
Recently I offered a good collegue/friend to create a map for his Garmin
GPS60 device of England. At first all seemed well, but then he
complained that the village he was going to on his next vacation could
not be found. The village was 'Chelsworth'.
I looked into it, and managed to solve it. In the process I learned 3
things and I would like to share the info. It could very well be that I
overlooked something, or be completely wrong, so please correct me where
needed.
1) Building Mkgmap/Splitter yourself with Eclipse/Ant. (Windows)
To be able to run the build Jar's with Java SE Runtime Environment
8 (https://www.java.com/nl/download/manual.jsp) I added release="8" to
build.xml. For Mkgmap and splitter.
Note: Ant requires JRE 11+, so I installed that JDK and that
resulted in the runtime requirement of JRE 11 in the build Jar's,
without the release="8" parameter.
2) Admin_level2 is required for setting the country, but that does not
work when you build the bound files yourself from a 'small' region.
I always thought it was best to create the bounds files myself using the
info on:
https://www.mkgmap.org.uk/news/2013/01/10/creating-pre-processed-boundaries
The example shown, with 'europe.osm.pbf' does work very well indeed. It
wasn't until I tried this procedure with 'england-latest.osm.pbf
<http://download.geofabrik.de/europe/great-britain/england-latest.osm.pbf>'
that I found that the resulting bounds files are smaller, and apparently
dont contain all the info needed to set the Admin_level2 and thus Country.
I tested this by adding debug lines like this in inc/address and looking
at the available tags.
addr:city=Ipswich { echotags "Ipswich" }
addr:village=Chelsworth { echotags "Chelsworth" }
(It turns out that many places (cities/villages) in England have
addr:village set, although its use is discouraged. Confusing, but handy
if you want to debug.)
To summarize: Either take the bounds files from
https://www.thkukuk.de/osm/data/bounds-latest.zip. Or if you want to
create them yourself take a large area like Europe.
3) The supplied inc/address file from the default style does not handle
all villages/cities well in England. Solution: If level10 is available
take that value for city.
According to
https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative
Level10 for England are civil parishes
Output from building the map using the debug lines in inc/address from
bullet 2. (You can see that now level2 is set correctly)
Some points dont have a level10:
Node generated from way 376991833 [addr:city=Ipswich,
addr:housenumber=9, addr:postcode=IP1 3SE, addr:street=Henley Road,
amenity=pub, building=yes, mkgmap:admin_level2=GBR,
mkgmap:admin_level4=England, mkgmap:admin_level6=Suffolk,
mkgmap:admin_level8=Ipswich, mkgmap:area2poi=true,
mkgmap:cache_area_size=35.823, mkgmap:label:1=The Greyhound, name=The
Greyhound] Ipswich
But if they do, that value should be taken for mkgmap:city, and not
level8. Level8 (Babergh) is the district Chelsworth belongs to.
Node 9352769232 [addr:city=Ipswich, addr:housenumber=24-26,
addr:postcode=IP7 7HU, addr:street=The Street, addr:village=Chelsworth,
amenity=pub, *mkgmap:admin_level10=Chelsworth*, mkgmap:admin_level2=GBR,
mkgmap:admin_level4=England, mkgmap:admin_level6=Suffolk,
mkgmap:admin_level8=Babergh, mkgmap:label:1=The Peacock, name=The
Peacock] Ipswich
Node 9352769232 [addr:city=Ipswich, addr:housenumber=24-26,
addr:postcode=IP7 7HU, addr:street=The Street, addr:village=Chelsworth,
amenity=pub,*mkgmap:admin_level10=Chelsworth*, mkgmap:admin_level2=GBR,
mkgmap:admin_level4=England, mkgmap:admin_level6=Suffolk,
mkgmap:admin_level8=Babergh, mkgmap:label:1=The Peacock, name=The
Peacock] Chelsworth
My solution is to add these lines in inc/address, just before the
'common city rules'
Copy&Paste version:
# Great Britain. Many Towns/Villages have there names in level10, not in
level8
# Todo: Maybe add mkgmap:admin_level4=England to selection?
mkgmap:country=GBR & mkgmap:city!=* & mkgmap:admin_level10=* { set
mkgmap:city='${mkgmap:admin_level10}' }
Cheers Frank
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev