Hi All,

I have noticed, that administrative borders in default style aren't processed as expected. There is attempt to create border name like "Region A/Region B", which doesn't work.

I propose 2 alternative patches:

"borders_clean.patch" removes dead code, leaving processing (almost) unchanged. Each border gets multiple lines (sometimes more than 10), each line with a single name from a relation.

"borders_optimize.patch" generates a single line for each border with concatenated names of the most important relations (lowest admin_level).

Since I don't use default style, I have done only a limited testing.

Other notes:
* boundary=national seems to be outdated and nearly extinct.
* boundary=political is something like electoral districts, probably should get other line type than administrative borders.
* admin_level=11 could be dropped or get different line type too.

--
Best regards,
Andrzej

Index: resources/styles/default/lines
===================================================================
--- resources/styles/default/lines      (revision 4923)
+++ resources/styles/default/lines      (working copy)
@@ -239,15 +239,12 @@
 (man_made=cable | (man_made=* & man_made~'.*pipe.*')) & area!=yes & 
tunnel!=yes & location!=underground
     {name '${name} (${operator})' | '${name}' | '${operator}'} [0x28 
resolution 23]
 
-# The following boundary styles are after the highway rules because ways
-# are frequently tagged with both and we want the highway to take priority.
-boundary=administrative {name '${mkgmap:boundary_name}'}
+# Boundary generatd from ways, that are created by the internal 
multi-polygon-relation handling.
 boundary=administrative & admin_level<3 [0x1e resolution 12]
 boundary=administrative & admin_level<5 [0x1d resolution 19]
 boundary=administrative & admin_level<7 [0x1c resolution 21]
 boundary=administrative & admin_level<9 [0x1c resolution 22]
 boundary=administrative [0x1c resolution 22]
-boundary=national [0x1e resolution 17]
 boundary=political [0x1c resolution 19]
 
 barrier=wall | barrier=fence | barrier=hedge | barrier=ditch {add 
name='${barrier|subst:"_=> "}'} [0x17 resolution 24]
Index: resources/styles/default/relations
===================================================================
--- resources/styles/default/relations  (revision 4923)
+++ resources/styles/default/relations  (working copy)
@@ -11,19 +11,6 @@
 # and http://wiki.openstreetmap.org/wiki/Mkgmap/help/Custom_styles
 # for more information.
 
-# Names of administrative boundaries.
-# We could want to sort the relations in ascending order of admin_level
-# and alphabetically by name first.
-# Currently, the matching relations will be processed and the names
-# appended to the boundary lines in an arbitrary order.
-
-(type=boundary | type=multipolygon) & boundary=administrative & name=*
-{ apply
-  {
-    set mkgmap:boundary_name='$(mkgmap:boundary_name)/${name}' | '${name}';
-  }
-}
-
 # Public transportation routes.
 # We could want to sort the matching relations by ref first.
 type=route
Index: resources/styles/default/lines
===================================================================
--- resources/styles/default/lines      (revision 4923)
+++ resources/styles/default/lines      (working copy)
@@ -12,6 +12,56 @@
 
 abandoned=yes {deletealltags}  # old, depreciated, ambiguous, method of 
handling abandoned
 
+# Boundary name from relations.
+if (mkgmap:boundary_name_1=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_1}'} [0x1e resolution 12 continue]
+end
+if (mkgmap:boundary_name_2=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_2}'} [0x1e resolution 12 continue]
+end
+if (mkgmap:boundary_name_3=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_3}'} [0x1d resolution 19 continue]
+end
+if (mkgmap:boundary_name_4=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_4}'} [0x1d resolution 19 continue]
+end
+if (mkgmap:boundary_name_5=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_5}'} [0x1c resolution 21 continue]
+end
+if (mkgmap:boundary_name_6=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_6}'} [0x1c resolution 21 continue]
+end
+if (mkgmap:boundary_name_7=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_7}'} [0x1c resolution 22 continue]
+end
+if (mkgmap:boundary_name_8=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_8}'} [0x1c resolution 22 continue]
+end
+if (mkgmap:boundary_name_9=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_9}'} [0x1c resolution 23 continue]
+end
+if (mkgmap:boundary_name_10=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_10}'} [0x1c resolution 23 continue]
+end
+if (mkgmap:boundary_name_11=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_11}'} [0x1c resolution 24 continue]
+end
+if (mkgmap:boundary_name_political=* & mkgmap:boundary_done!=yes) then
+       () {set mkgmap:boundary_done=yes}
+       () {name '${mkgmap:boundary_name_political}'} [0x1c resolution 24 
continue]
+end
+
 # do these as lines regardless of being closed unless explicity marked as 
area. continue in case also a highway
 aeroway=runway & area!=yes {name '${ref}'} [0x27 resolution 20 continue]
 (aeroway=taxiway | aeroway=taxilane) & area!=yes {name '${ref}'} [0x27 
resolution 24 continue]
@@ -239,17 +289,6 @@
 (man_made=cable | (man_made=* & man_made~'.*pipe.*')) & area!=yes & 
tunnel!=yes & location!=underground
     {name '${name} (${operator})' | '${name}' | '${operator}'} [0x28 
resolution 23]
 
-# The following boundary styles are after the highway rules because ways
-# are frequently tagged with both and we want the highway to take priority.
-boundary=administrative {name '${mkgmap:boundary_name}'}
-boundary=administrative & admin_level<3 [0x1e resolution 12]
-boundary=administrative & admin_level<5 [0x1d resolution 19]
-boundary=administrative & admin_level<7 [0x1c resolution 21]
-boundary=administrative & admin_level<9 [0x1c resolution 22]
-boundary=administrative [0x1c resolution 22]
-boundary=national [0x1e resolution 17]
-boundary=political [0x1c resolution 19]
-
 barrier=wall | barrier=fence | barrier=hedge | barrier=ditch {add 
name='${barrier|subst:"_=> "}'} [0x17 resolution 24]
 
 route=ferry & (toll=no | toll=false) {set mkgmap:toll=no}
Index: resources/styles/default/relations
===================================================================
--- resources/styles/default/relations  (revision 4923)
+++ resources/styles/default/relations  (working copy)
@@ -12,17 +12,67 @@
 # for more information.
 
 # Names of administrative boundaries.
-# We could want to sort the relations in ascending order of admin_level
-# and alphabetically by name first.
-# Currently, the matching relations will be processed and the names
-# appended to the boundary lines in an arbitrary order.
-
-(type=boundary | type=multipolygon) & boundary=administrative & name=*
-{ apply
-  {
-    set mkgmap:boundary_name='$(mkgmap:boundary_name)/${name}' | '${name}';
-  }
+# Relations sorted in ascending order of admin_level.
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=1
+{      apply {
+               set mkgmap:boundary_name_1='$(mkgmap:boundary_name_1)/${name}' 
| '${name}';
+       }
 }
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=2
+{      apply {
+               set mkgmap:boundary_name_2='$(mkgmap:boundary_name_2)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=3
+{      apply {
+               set mkgmap:boundary_name_3='$(mkgmap:boundary_name_3)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=4
+{      apply {
+               set mkgmap:boundary_name_4='$(mkgmap:boundary_name_4)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=5
+{      apply {
+               set mkgmap:boundary_name_5='$(mkgmap:boundary_name_5)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=6
+{      apply {
+               set mkgmap:boundary_name_6='$(mkgmap:boundary_name_6)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=7
+{      apply {
+               set mkgmap:boundary_name_7='$(mkgmap:boundary_name_7)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=8
+{      apply {
+               set mkgmap:boundary_name_8='$(mkgmap:boundary_name_8)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=9
+{      apply {
+               set mkgmap:boundary_name_9='$(mkgmap:boundary_name_9)/${name}' 
| '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=10
+{      apply {
+               set 
mkgmap:boundary_name_10='$(mkgmap:boundary_name_10)/${name}' | '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=administrative & name=* & 
admin_level=11
+{      apply {
+               set 
mkgmap:boundary_name_11='$(mkgmap:boundary_name_11)/${name}' | '${name}';
+       }
+}
+(type=boundary | type=multipolygon) & boundary=political & name=*
+{      apply {
+               set 
mkgmap:boundary_name_political='$(mkgmap:boundary_name_political)/${name}' | 
'${name}';
+       }
+}
 
 # Public transportation routes.
 # We could want to sort the matching relations by ref first.
_______________________________________________
mkgmap-dev mailing list -- mkgmap-dev@lists.mkgmap.org.uk
To unsubscribe send an email to mkgmap-dev-le...@lists.mkgmap.org.uk
%(web_page_url)slistinfo/%(_internal_name)s

Reply via email to