Re: [mkgmap-dev] Observations with addresses in England

2023-04-13 Thread Ticker Berkin
Hi Frank

Some quick comments:

1/ Whatever you need to do to make it run on old versions of Java.

2/ I've always used the pre-build bounds-latest.zip file from
   https://www.mkgmap.org.uk/download/mkgmap.html
   which redirects to the site you mention.
   This global file is designed to avoid the problems you experienced.

3/ in {style}/inc/address, I replace:

mkgmap:city!=* & mkgmap:admin_level8=*
 { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:city!=* & mkgmap:admin_level7=*
 { set mkgmap:city='${mkgmap:admin_level7}' }
mkgmap:city!=* & mkgmap:admin_level9=*
 { set mkgmap:city='${mkgmap:admin_level9}' }
mkgmap:city!=* & mkgmap:admin_level10=*
 { set mkgmap:city='${mkgmap:admin_level10}' }

with:

mkgmap:city!=* & mkgmap:admin_level10=*
 { set mkgmap:city='${mkgmap:admin_level10|subst:" CP=>"}' }
mkgmap:city!=* & mkgmap:admin_level9=*
 { set mkgmap:city='${mkgmap:admin_level9}' }
mkgmap:city!=* & mkgmap:admin_level8=*
 { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:city!=* & mkgmap:admin_level7=*
 { set mkgmap:city='${mkgmap:admin_level7}' }
mkgmap:city!=* & mkgmap:admin_level6=*
 { set mkgmap:city='${mkgmap:admin_level6}' }

which works much better for GBR

Regards
Ticker

On Wed, 2023-04-12 at 12:59 +0200, Frank Bijnen wrote:
>  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'
> 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-dev] Observations with addresses in England

2023-04-12 Thread Frank Bijnen

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 
' 
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 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