logo separator

[mkgmap-dev] [locator] Country specific rules

From Carlos Dávila cdavilam at orangecorreo.es on Thu Jun 2 11:15:21 BST 2011

El 27/05/11 19:26, WanMil escribió:
> Am 21.05.2011 19:45, schrieb Carlos Dávila:
>> El 20/05/11 11:06, Carlos Dávila escribió:
>>> El 20/05/11 00:07, Carlos Dávila escribió:
>>>> El 19/05/11 23:15, WanMil escribió:
>>>>>> El 19/05/11 22:12, WanMil escribió:
>>>>>>>> El 19/05/11 21:29, WanMil escribió:
>>>>>>>>>> El 16/05/11 19:27, Minko escribió:
>>>>>>>>>>> Cool!
>>>>>>>>>>> I can use these locator rules also for the multiple language expressions in the 'default_name':
>>>>>>>>>>> http://www.mail-archive.com/mkgmap-dev@lists.mkgmap.org.uk/msg07697.html
>>>>>>>>>>>
>>>>>>>>>>> Example:
>>>>>>>>>>> leisure=pitch&            sport=soccer&            (mkgmap:country=NLD | mgkmap:region=Vlaanderen) [0x19 default_name="voetbalveld" resolution 23]
>>>>>>>>>>> leisure=pitch&            sport=soccer&            mkgmap:country=DEU  [0x19 default_name="Fussballfeld" resolution 23]
>>>>>>>>>>> leisure=pitch&            sport=soccer&            (mkgmap:country=FRA | mgkmap:region="Région Wallone") [0x19 default_name="terrain de football" resolution 23]
>>>>>>>>>>> leisure=pitch&            sport=soccer [0x19 resolution 23]
>>>>>>>>>> I tried rules of type below, but it doesn't work for Morocco.
>>>>>>>>>> highway=primary&           (mkgmap:country=ETH | mkgmap:country=MAR) [0x03
>>>>>>>>>> road_class=3 road_speed=5 resolution 16]
>>>>>>>>>> highway=primary [0x03 road_class=3 road_speed=5 resolution 18]
>>>>>>>>>>
>>>>>>>>>> MapSouce shows "Morocco (MOR)" in the countries list, although
>>>>>>>>>> LocatorConfig.xml has the rule below and there's no occurrence of "MOR"
>>>>>>>>>> in the OSM data.
>>>>>>>>>> <country name="Morocco" abr="MAR">
>>>>>>>>>> <variant>MA</variant>
>>>>>>>>>> <variant>MAR</variant>
>>>>>>>>>> </country>
>>>>>>>>>> I know I could use MOR instead of MAR in my style but, shouldn't it be
>>>>>>>>>> consistent with the LocatorConfig?
>>>>>>>>> It seems as if the LocatorConfig you changed is not used by mkgmap. Do
>>>>>>>>> you use a downloaded mkgmap.jar? I am not sure where your changed
>>>>>>>>> LocatorConfig.xml must be placed so that mkgmap does not use the bundled
>>>>>>>>> LocatorConfig.xml.
>>>>>>>> I have not changed LocatorConfig.xml, I'm using the default one. I use a
>>>>>>>> self compiled jar.
>>>>>>> Oh, I am sorry. I mixed up some things.
>>>>>> Well, I'm must also say I'm sorry, as checking my parameters I've seen
>>>>>> MOR was coming from my --country-abbr:-[ , but changing it to the right
>>>>>> "MAR" didn't make the style work, although MapSource now lists "Morocco
>>>>>> (MAR)"
>>>>> That's good because this question is answered :-)
>>>>>
>>>>> The style can work only if the boundaries of Morocco are contained in
>>>>> the precompiled boundary tiles. I think my europe compilation may
>>>>> contain a small part of northern morocco.
>>>>> So you should do the following steps:
>>>>> 1. Check that the boundary multipolygon of Morocco is complete and valid
>>>>> 2. Precompile the boundary tiles
>>>>> 3. Compile your map again using the precompiled boundary tiles
>>>>>
>>>>> Then the style rules should work.
>>>> I had already compiled Morocco's boundary (extracted from Geofabrik
>>>> morocco.osm.pbf). What I didn't is converting bnd to gpx and checking
>>>> it, but that will be tomorrow...
>>> I checked part of the bound tiles and they are correct. Here are all my
>>> steps, so you can see if I'm doing something wrong:
>>> 1-Extract boundaries:
>>> osmosis \
>>> --read-pbf file=morocco.osm.pbf outPipe.0=1 \
>>> --tee 2 inPipe.0=1 outPipe.0=2 outPipe.1=3 \
>>> --buffer inPipe.0=3 outPipe.0=4 \
>>> --buffer inPipe.0=2 outPipe.0=5 \
>>> --tag-filter accept-relations boundary=administrative inPipe.0=4
>>> outPipe.0=6 \
>>> --used-way inPipe.0=6 outPipe.0=7 \
>>> --tag-filter reject-relations inPipe.0=5 outPipe.0=8 \
>>> --tag-filter accept-ways boundary=administrative inPipe.0=8 outPipe.0=9 \
>>> --used-node inPipe.0=9 outPipe.0=10 \
>>> --used-node inPipe.0=7 outPipe.0=11 \
>>> --merge inPipe.0=10 inPipe.1=11 outPipe.0=12 \
>>> --write-pbf file=morocco-boundaries.osm.pbf omitmetadata=true
>>> compress=deflate inPipe.0=12
>>>
>>> 2-Map compilation:
>>> time /usr/lib/jvm/java-6-sun/bin/java -Xmx400m -enableassertions
>>> -Dlog.config=logging.properties -jar mkgmap-locator.jar
>>> --createboundsfile=morocco-boundaries.osm.pbf
>>> --boundsdirectory=bounds_morocco --generate-sea=extend-sea-sectors
>>> --route --tdbfile --latin1 --code-page=1252
>>> --description="OpenStreetMap-Morocco" --gmapsupp --country-name=MOROCCO
>>> --country-abbr=MAR --family-name="Open Street Map" --family-id=17
>>> --product-id=1 --series-name="OSM-Morocco" --area-name="Morocco"
>>> --overview-mapname=55170000 --mapname=55170000
>>> --name-tag-list=int_name,name --index --road-name-pois=0x640a
>>> --ignore-maxspeeds --remove-short-arcs --merge-lines --add-pois-to-areas
>>> --adjust-turn-headings --report-similar-arcs --link-pois-to-ways
>>> --location-autofill=0 --drive-on-right --check-roundabouts
>>> --check-roundabout-flares --style=mio typ/MOROC-17.TYP morocco.osm.pbf
>> I've seen streets/roads don't have city, region, country information
>> assigned in my Morocco's map when searched in MapSource. As there's no
>> city boundary and nearly no region boundary in OSM data mkgmap:region!=*
>> and mkgmap:city!=* rules in style fail to fill that info and this seems
>> to block country info to be assigned even if it is present. I have tuned
>> style to assign a default city and region when missing and then country
>> is correctly set (and also region if present), but even so, rule
>> "highway=primary&   (mkgmap:country=ETH | mkgmap:country=MAR) [0x03
>> road_class=3 road_speed=5 resolution 16]" is not applied.
>
> Carlos,
>
> I have not forgotten your described problem.
>
> 1. Country specific rules are not applied
> I cannot reproduce that.
> I have stripped down a style to use only the line file with the
> following content:
> mkgmap:country!=*&  mkgmap:admin_level2=* { set
> mkgmap:country='${mkgmap:admin_level2}' }
> mkgmap:country=DEU&  highway=* [0x06 road_class=0 road_speed=2
> resolution 22]
>
> So all highways (no matter which type) in Germany should be contained in
> the map.
>
> I compiled two tiles which cover some parts of germany and some parts of
> the Netherlands. The resulting map contains only all highways in
> germany. So the country specific rule seems to work.
I have followed your approach, but still can't get it working for 
Morocco. In order to get it working for Spain, I had to manually create 
an osm file with admin_level 2 relation (1311641) and merge it with the 
Europe's extract from geofabrik, as part of the boundaries seem to be 
missing in it, and then re-create the boundaries files. I did the same 
for Morocco (africa+mocorro) but it didn't work. I also tried changing 
name tag in morocco's admin_level 2 relation from the Arabic name to 
Morocco (I seem to recall name-tag-list doesn't work for relations) with 
no success, so now I don't know what else to try.
My commands:
osmosis --rb africa.osm.pbf --rx boundary_morocco.osm --merge --wb 
africa-morocco.osm.pbf omitmetadata=true

osmosis --read-pbf file=africa-morocco.osm.pbf outPipe.0=1 --tee 2 
inPipe.0=1 outPipe.0=2 outPipe.1=3 --buffer inPipe.0=3 outPipe.0=4 
--buffer inPipe.0=2 outPipe.0=5 --tag-filter accept-relations 
boundary=administrative inPipe.0=4 outPipe.0=6 --used-way inPipe.0=6 
outPipe.0=7 --tag-filter reject-relations inPipe.0=5 outPipe.0=8 
--tag-filter accept-ways boundary=administrative inPipe.0=8 outPipe.0=9 
--used-node inPipe.0=9 outPipe.0=10 --used-node inPipe.0=7 outPipe.0=11 
--merge inPipe.0=10 inPipe.1=11 outPipe.0=12 --write-pbf 
file=africa-boundaries.osm.pbf omitmetadata=true compress=deflate 
inPipe.0=12

java -Xmx400m -enableassertions -Dlog.config=logging.properties -jar 
mkgmap-locator.jar --createboundsfile=africa-boundaries.osm.pbf 
--boundsdirectory=bounds_africa --generate-sea=extend-sea-sectors 
--route --tdbfile --latin1 --code-page=1252 
--description="OpenStreetMap-Morocco" --family-name="Open Street Map" 
--family-id=17 --product-id=1 --series-name="OSM-Morocco" 
--area-name="Morocco" --overview-mapname=55170000 --mapname=55170000 
--name-tag-list=int_name,name --index --ignore-maxspeeds 
--remove-short-arcs --merge-lines --add-pois-to-areas 
--adjust-turn-headings --report-similar-arcs --link-pois-to-ways 
--location-autofill=0 --drive-on-right --check-roundabouts 
--check-roundabout-flares --style=rules typ/MOROC-17.TYP morocco.osm.pbf

My "rules" style lines file for the test:
mkgmap:country!=* & mkgmap:admin_level2=* { set 
mkgmap:country='${mkgmap:admin_level2}' }
mkgmap:country=MAR & highway=* [0x03 road_class=3 road_speed=5 
resolution 16]
mkgmap:country=ESP & highway=* [0x02 road_class=3 road_speed=5 
resolution 18]

After compiling the map only shows highways in the two Spanish cities in 
the North of Morocco.
> 2. Country info only is not applied
> You are right. At the moment each POI must have the city/region/country
> or city/country information. Without that the country information cannot
> be applied. This is not a problem of the locator branch but more a
> general problem of how the index is created. Maybe Steve can explain
> what combinations should be possible (although they might not be
> implemented yet). Some work has to be done at this point.




More information about the mkgmap-dev mailing list