logo separator

[mkgmap-dev] Finding administrative areas

From Roger Calvert roger at rogercalvert.me.uk on Tue Aug 7 17:32:54 BST 2012

Thanks, Steve.

The lines file is attached. The only line which causes problems is the 
one testing the admin_level at line 224. (This is where it is because I 
want to do things with waterways with it, but when I started getting 
problems, I changed it to Wanmil's example line.) It all works fine when 
this line is commented out.

Thank you for the patch, but I am afraid I cannot (or do not know how 
to) make use of it - I have not downloaded the source, only the Windows 
zip package.

Regards,

Roger

On 07/08/2012 15:55, Steve Ratcliffe wrote:
> On 07/08/12 13:40, Roger Calvert wrote:
>> I have been unable to make this work. I have copied all the admin_level
>> rules from the default style files into my style, and introduced
>> pre-compiled bounds. Using mkgmap r2130 and Wanmil's sample rule (as
>> below),  I always get a java exception (below). I have tried various
>> variants on the rule and various data sets, with no differences.
>>
>> Advice welcomed!
>
> There is probably a typo in the lines file, if you send it to me
> I can probably spot it.
>
> We can do a better error message than that though. Attached is a
> patch which should print the line number of the problem and make it
> a lot easier to find.
>
> ..Steve
>
>
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

-- 
------------------------------------------------------------------------

Roger Calvert
------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20120807/aaa363f0/attachment.html 
-------------- next part --------------
# Roger's style by Roger Calvert

# Location information copied from default style 07/08/2012
# first set the country code
mkgmap:country!=* & mkgmap:admin_level2=* { set mkgmap:country='${mkgmap:admin_level2}' }
mkgmap:country!=* & addr:country=* { set mkgmap:country='${addr:country}' }
mkgmap:country!=* & is_in:country=* { set mkgmap:country='${is_in:country}' }

# country specific rules first

# Netherlands = NLD
mkgmap:country=NLD & mkgmap:region!=* & mkgmap:admin_level4=* { set mkgmap:region='${mkgmap:admin_level4}' }
mkgmap:country=NLD & mkgmap:city!=* & mkgmap:admin_level10=* { set mkgmap:city='${mkgmap:admin_level10}' } 
mkgmap:country=NLD & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' } 

# Germany = DEU cities
mkgmap:country=DEU & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' } 
mkgmap:country=DEU & mkgmap:city!=* & mkgmap:admin_level7=* { set mkgmap:city='${mkgmap:admin_level7}' } 
mkgmap:country=DEU & mkgmap:city!=* & mkgmap:admin_level6=* { set mkgmap:city='${mkgmap:admin_level6}' } 
mkgmap:country=DEU & mkgmap:city!=* & mkgmap:admin_level9=* { set mkgmap:city='${mkgmap:admin_level9}' } 
mkgmap:country=DEU & mkgmap:city!=* & mkgmap:admin_level10=* { set mkgmap:city='${mkgmap:admin_level10}' } 


# other european countries
mkgmap:country=AUT & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=BEL & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=CZE & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=CZE & mkgmap:city!=* & mkgmap:admin_level7=* { set mkgmap:city='${mkgmap:admin_level7}' }
mkgmap:country=DNK & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=DNK & mkgmap:city!=* & mkgmap:admin_level7=* { set mkgmap:city='${mkgmap:admin_level7}' }
mkgmap:country=FIN & mkgmap:city!=* & mkgmap:admin_level9=* { set mkgmap:city='${mkgmap:admin_level9}' }
mkgmap:country=FIN & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=FRA & mkgmap:city!=* & mkgmap:admin_level9=* { set mkgmap:city='${mkgmap:admin_level9}' }
mkgmap:country=FRA & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=ISL & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=ITA & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=LUX & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=NOR & mkgmap:city!=* & mkgmap:admin_level9=* { set mkgmap:city='${mkgmap:admin_level9}' }
mkgmap:country=POL & mkgmap:city!=* & mkgmap:admin_level10=* { set mkgmap:city='${mkgmap:admin_level10}' }
mkgmap:country=POL & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=PRT & mkgmap:city!=* & mkgmap:admin_level9=* { set mkgmap:city='${mkgmap:admin_level9}' }
mkgmap:country=PRT & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=SVN & mkgmap:city!=* & mkgmap:admin_level10=* { set mkgmap:city='${mkgmap:admin_level10}' }
mkgmap:country=ESP & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
mkgmap:country=SWE & mkgmap:city!=* & mkgmap:admin_level9=* { set mkgmap:city='${mkgmap:admin_level9}' }
mkgmap:country=SWE & mkgmap:city!=* & mkgmap:admin_level7=* { set mkgmap:city='${mkgmap:admin_level7}' }
mkgmap:country=CHE & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
 
# Canda
mkgmap:country=CAN & mkgmap:region!=* & mkgmap:admin_level4=* { set mkgmap:region='${mkgmap:admin_level4}' }
mkgmap:country=CAN & mkgmap:city!=* & mkgmap:admin_level8=* { set mkgmap:city='${mkgmap:admin_level8}' }
  
# common rules for all the rest of countries
mkgmap:region!=* & mkgmap:admin_level6=* { set mkgmap:region='${mkgmap:admin_level6}' } 
mkgmap:region!=* & mkgmap:admin_level5=* { set mkgmap:region='${mkgmap:admin_level5}' } 
mkgmap:region!=* & mkgmap:admin_level4=* { set mkgmap:region='${mkgmap:admin_level4}' } 
mkgmap:region!=* & mkgmap:admin_level3=* { set mkgmap:region='${mkgmap:admin_level3}' } 
mkgmap:region!=* & is_in:county=* { set mkgmap:region='${is_in:county}' } 

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}' } 
mkgmap:city!=* & is_in:city=* { set mkgmap:city='${is_in:city}' }
mkgmap:city!=* & addr:city=* { set mkgmap:city='${addr:city}' }

mkgmap:postal_code!=* & mkgmap:postcode=* { set mkgmap:postal_code='${mkgmap:postcode}' } 
mkgmap:postal_code!=* & addr:postcode=* { set mkgmap:postal_code='${addr:postcode}' } 
# end of location code

mkgmap:street!=* & addr:street=* { set mkgmap:street='${addr:street}' }
mkgmap:street!=* & addr:housename=* { set mkgmap:street='${addr:housename}' }

mkgmap:housenumber!=* & addr:housenumber=* { set mkgmap:housenumber='${addr:housenumber}' }

mkgmap:phone!=* & phone=* { set mkgmap:phone='${phone}' }
mkgmap:phone!=* & contact:phone=* { add mkgmap:phone='${contact:phone}' }

mkgmap:is_in!=* & is_in=* { set mkgmap:is_in='${is_in}' }

# special tagged roads...
highway=construction | highway=proposed | construction=*  {add access = no}
surface=unpaved	[0x0a road_class=0 road_speed=0 level 0]
motorroad=yes	{add bicycle = no; add foot = no}

# Needed for car routing (garmin cannot differentiate cars and bykes). Comment out for motorcycle maps
motorcycle=no {set motorcycle=yes}

# Road_speed: 7=128Km/h, 6=108Km/h, 5=93km/h, 4=72km/h, 3=56km/h, 2=40km/h, 1=20km/h 0=8km/h

# residentials
junction=roundabout & highway=residential	[0x0c road_class=1 road_speed=1 level 0]
highway=residential	[0x06 road_class=1 road_speed=1 level 0]

# unclassified & minor. If you want a default name: (highway=unclassified | highway=minor) {add name = 'road'}
junction=roundabout & (highway=unclassified | highway=minor)	[0x0c road_class=1 road_speed=1 level 1]
(highway=unclassified | highway=minor) & maxspeed>60	[0x06 road_class=1 road_speed=3 level 1]
(highway=unclassified | highway=minor) & maxspeed>50	[0x06 road_class=1 road_speed=2 level 1]
(highway=unclassified | highway=minor) & maxspeed<51	[0x06 road_class=1 road_speed=1 level 1]
(highway=unclassified | highway=minor) 					[0x06 road_class=1 road_speed=2 level 1]

# Set highway names to include the reference if there is one
highway=motorway	{name '${name} (${ref|highway-symbol:hbox})' | '${ref|highway-symbol:hbox}' | '${name}' }
highway=trunk		{name '${name} (${ref|highway-symbol:hbox})' | '${ref|highway-symbol:hbox}' | '${name}' }
highway=primary		{name '${name} (${ref|highway-symbol:box})'  | '${ref|highway-symbol:box}'  | '${name}' }
highway=secondary	{name '${name} (${ref|highway-symbol:oval})' | '${ref|highway-symbol:oval}' | '${name}' }
highway=tertiary	{name '${name} (${ref})' | '${ref}' | '${name}' }

# tertiarys
junction=roundabout & (highway=tertiary | highway=tertiary_link)	[0x0c road_class=2 road_speed=1 level 1]
(highway=tertiary | highway=tertiary_link) & maxspeed>60	[0x06 road_class=2 road_speed=4 level 1]
(highway=tertiary | highway=tertiary_link) & maxspeed>50	[0x06 road_class=2 road_speed=3 level 1]
(highway=tertiary | highway=tertiary_link) & maxspeed<51 	[0x06 road_class=2 road_speed=2 level 1]
(highway=tertiary | highway=tertiary_link) [0x06 road_class=2 road_speed=3 level 1]

# secondarys
junction=roundabout & (highway=secondary | highway=secondary_link)[0x0c road_class=2 road_speed=2 level 1]
(highway=secondary | highway=secondary_link) & maxspeed>60	[0x05 road_class=3 road_speed=4 level 1]
(highway=secondary | highway=secondary_link) & maxspeed>50	[0x05 road_class=2 road_speed=3 level 1]
(highway=secondary | highway=secondary_link) & maxspeed<51	[0x05 road_class=2 road_speed=2 level 1]
(highway=secondary | highway=secondary_link) 				[0x05 road_class=2 road_speed=3 level 1]

# primarys
junction=roundabout & (highway=primary | highway=primary_link)	[0x0c road_class=3 road_speed=3 level 3]
highway=primary & maxspeed>80 [0x04 road_class=3 road_speed=5 level 3]
highway=primary & maxspeed>60 [0x04 road_class=3 road_speed=4 level 3]
highway=primary & maxspeed<61 [0x04 road_class=3 road_speed=3 level 3]
highway=primary   			  [0x04 road_class=3 road_speed=4 level 3]

highway=primary_link & maxspeed>50	[0x09 road_class=3 road_speed=3 level 2]
highway=primary_link & maxspeed<51	[0x08 road_class=2 road_speed=2 level 2]
highway=primary_link				[0x08 road_class=2 road_speed=2 level 2]

# trunks
junction=roundabout & (highway=trunk | highway=trunk_link)	[0x0c road_class=3 road_speed=4 level 4]

highway=trunk & maxspeed>100	[0x02 road_class=4 road_speed=5 level 4]
highway=trunk & maxspeed>80		[0x02 road_class=3 road_speed=5 level 4]
highway=trunk & maxspeed>60 	[0x02 road_class=3 road_speed=4 level 4]
highway=trunk & maxspeed<61		[0x02 road_class=3 road_speed=3 level 4]
highway=trunk 			[0x02 road_class=3 road_speed=5 level 4]

highway=trunk_link & maxspeed>60	[0x09 road_class=3 road_speed=4 level 2]
highway=trunk_link & maxspeed>50	[0x09 road_class=3 road_speed=3 level 2]
highway=trunk_link & maxspeed<51	[0x08 road_class=3 road_speed=2 level 2]
highway=trunk_link					[0x08 road_class=3 road_speed=2 level 2]

# motorways (ignore "roundabout" if any), motorway_link may be 2-ways
highway=motorway {add oneway = yes; add bicycle = no; add foot = no}
highway=motorway_link {add bicycle = no; add foot = no} 

highway=motorway & (maxspeed>130 | maxspeed=none)	[0x01 road_class=4 road_speed=7 level 5]
highway=motorway &  maxspeed>100	[0x01 road_class=4 road_speed=6 level 5]
highway=motorway &  maxspeed>80		[0x01 road_class=4 road_speed=5 level 5]
highway=motorway &  maxspeed<81		[0x01 road_class=3 road_speed=4 level 5]
highway=motorway					[0x01 road_class=4 road_speed=6 level 5]

highway=motorway_link & lanes>1 & maxspeed>100	[0x0b road_class=4 road_speed=6 level 4]
highway=motorway_link & lanes>1 & maxspeed>80	[0x0b road_class=4 road_speed=5 level 4]
highway=motorway_link & lanes>1 & maxspeed>60	[0x0b road_class=3 road_speed=4 level 4]
highway=motorway_link & lanes>1 & maxspeed<61	[0x0b road_class=3 road_speed=3 level 4]
highway=motorway_link & lanes>1					[0x0b road_class=3 road_speed=4 level 4]

highway=motorway_link & maxspeed>80	[0x09 road_class=3 road_speed=5 level 2]
highway=motorway_link & maxspeed>60	[0x09 road_class=3 road_speed=4 level 2]
highway=motorway_link & maxspeed>50	[0x09 road_class=3 road_speed=3 level 2]
highway=motorway_link & maxspeed<51	[0x08 road_class=3 road_speed=2 level 2]
highway=motorway_link				[0x08 road_class=3 road_speed=2 level 2]

# Not already assigned roundabouts.
junction=roundabout		[0x0c road_class=1 road_speed=1 level 0]

# service & living_streets
highway=service			[0x07 road_class=0 road_speed=1 level 0]
highway=living_street	[0x07 road_class=0 road_speed=0 level 0]

# Garmin routable: 0x01..0x13,0x16,0x1a,0x1b - Garmin standard: 0x0a unpaved, 0x16 Path

# Convert generic path to most specific
highway=path & bicycle=designated	{set highway=cycleway }
highway=path & horse=designated		{set highway=bridleway }
highway=path & foot=designated		{set highway=footway }
highway=footway | highway=pedestrian | highway=path {add motorcar = no} [0x16 road_class=0 road_speed=0 level 1]

highway=track & tracktype=grade1 						[0x0a road_class=0 road_speed=2 level 1]
highway=track & tracktype=grade2						[0x0a road_class=0 road_speed=1 level 1]
highway=track & tracktype=grade3						[0x0a road_class=0 road_speed=0 level 1]
highway=track & tracktype=grade4 {add motorcar = no}	[0x0a road_class=0 road_speed=0 level 1]
highway=track & tracktype=grade5 {add motorcar = no}	[0x16 road_class=0 road_speed=0 level 1]

highway=track | highway=unsurfaced | highway=unpaved	[0x0a road_class=0 road_speed=0 level 1]

highway=steps {add motorcar = no; add bicycle = no} [0x16 road_class=0 road_speed=0 level 0]
highway=cycleway 	{add motorcar = no}				[0x16 road_class=0 road_speed=1 level 0]
highway=bridleway	{add motorcar = no}				[0x0a road_class=0 road_speed=0 level 1]
highway=byway										[0x0a road_class=0 road_speed=0 level 0]

# Mop up any unrecognised highway types but keep areas like pedestrian for polygons!
highway=* & area!=yes & area!=true & area!=1 [0x07 road_class=0 road_speed=0 level 0]

route=ferry {add mkgmap:ferry=1} [0x1b road_class=0 road_speed=0 level 1]

# Other features
# 5 Mar 2012 viaducts not showing up as different - overlay introduced
#railway=rail		[0x14 level 5]
#railway=light_rail	[0x14 level 5]
#railway=preserved       [0x14 level 5]
#railway=narrow_gauge	[0x14 level 5]
railway=abandoned       [0x11 level 1]
railway=subway		[0x14 level 1]
railway=tram		[0x14 level 0]
railway=platform    {add access = no; add foot = yes} [0x16 road_class=0 road_speed=0 level 0]
# Mop up other railways
railway=* & bridge=viaduct [0x10304 level 2 continue]
railway=*			[0x11 level 2]


natural=coastline	[0x15 level 5]
# canal code changed JRC 5/3/12
aeroway=runway		[0x27 level 2]
waterway=river		[0x1f level 3]
waterway=canal		[0x10305 level 3]
waterway=drain		[0x26 level 1]
mkgmap:admin_level6=Cumbria && highway=primary { set highway=secondary }
waterway=stream		[0x18 level 1]

power=line & voltage>0 {name '${voltage} Volt power line' } [0x29 level 0]
power=line [0x29 level 0]

man_made=pipeline	[0x28 resolution 24]

#boundaries

boundary=administrative & admin_level<3	[0x1e level 5]
boundary=administrative	& admin_level<5 [0x1d level 4]
boundary=administrative	& admin_level<7 [0x1d level 2]
boundary=administrative					[0x1c level 1]
boundary=political						[0x1c level 1]
boundary=national						[0x1e level 5]

# aerialway=chair_lift | aerialway=drag_lift | aerialway=cable_car [0x38 level 2]
# for ski lifts, use code for railway
aerialway=chair_lift {name 'Chair lift ${name}'} [0x14 level 2]
aerialway=drag_lift | aerialway=platter {name 'Drag lift ${name}'} [0x14 level 2]
aerialway=cable_car {name 'Cable car ${name}'} [0x14 level 2]
aerialway=gondola {name 'Gondola ${name}'} [0x14 level 2]
aerialway=* {name 'Cable way ${name}'} [0x14 level 2]

# map pistes as paths
piste:type=downhill {name 'Piste ${name}'} [0x16 level 2]

# national grid lines - using high-number codes

national_grid=100km [0x10302 level 3]
national_grid=10km [0x10301 level 2]
national_grid=1km [0x10300 level 1]
national_grid=* [0x10301 level 2]

#jrc 28 jan 2012

# Piers and jetties(also in polygons)
man_made=jetty & area!=yes & area!=true & area!=1 [0x10303 level 1 continue]
man_made=pier & area!=yes & area!=true & area!=1 [0x10303 level 1 continue]


More information about the mkgmap-dev mailing list