From 4c6c8902c003f50773a37b19a744cbf662a5bd91 Mon Sep 17 00:00:00 2001 From: nebulon42 Date: Tue, 1 Dec 2015 20:34:09 +0100 Subject: [PATCH] rework admin boundaries (without z4 logic) --- admin.mss | 81 ++++++++++++++++++++++++++++++++++++++++---------- placenames.mss | 41 ++++++++++++++++++------- project.mml | 6 ++-- project.yaml | 3 ++ shapefiles.mss | 8 ++++- 5 files changed, 109 insertions(+), 30 deletions(-) diff --git a/admin.mss b/admin.mss index d586f74b9c..4bc055af85 100644 --- a/admin.mss +++ b/admin.mss @@ -9,45 +9,86 @@ overlapping borders correctly. #admin-low-zoom[zoom < 11], #admin-mid-zoom[zoom >= 11][zoom < 13], #admin-high-zoom[zoom >= 13] { - [admin_level = '2'], - [admin_level = '3'] { + [admin_level = '2'] { [zoom >= 4] { + background/line-join: bevel; background/line-color: white; - background/line-width: 0.6; + background/line-width: 1.2; + line-join: bevel; line-color: @admin-boundaries; - line-width: 0.6; + line-width: 1.2; + } + [zoom >= 5] { + background/line-width: 1.5; + line-width: 1.5; + } + [zoom >= 6] { + background/line-width: 1.8; + line-width: 1.8; } [zoom >= 7] { background/line-width: 2; line-width: 2; } [zoom >= 10] { - [admin_level = '2'] { - background/line-width: 6; - line-width: 6; - } - [admin_level = '3'] { - background/line-width: 5; - line-width: 5; - line-dasharray: 4,2; - line-clip: false; - } + background/line-width: 6; + line-width: 6; } } - [admin_level = '4'] { + + [admin_level = '3'] { [zoom >= 4] { + background/line-join: bevel; background/line-color: white; background/line-width: 0.6; + line-join: bevel; line-color: @admin-boundaries; line-width: 0.6; + } + [zoom >= 7] { + background/line-width: 1.2; + line-width: 1.2; + } + [zoom >= 10] { + background/line-width: 4; + line-width: 4; + line-dasharray: 4,2; + line-clip: false; + } + } + + [admin_level = '4'] { + [zoom >= 4] { + background/line-join: bevel; + background/line-color: white; + background/line-width: 0.4; + line-color: @admin-boundaries; + line-join: bevel; + line-width: 0.4; line-dasharray: 4,3; line-clip: false; } + [zoom >= 5] { + background/line-width: 0.6; + line-width: 0.6; + } + [zoom >= 6] { + background/line-width: 0.8; + line-width: 0.8; + } [zoom >= 7] { background/line-width: 1; line-width: 1; } - [zoom >= 11] { + [zoom >= 9] { + background/line-width: 1.8; + line-width: 1.8; + } + [zoom >= 10] { + background/line-width: 2.5; + line-width: 2.5; + } + [zoom >= 12] { background/line-width: 3; line-width: 3; } @@ -70,16 +111,20 @@ overlapping borders correctly. #admin-mid-zoom[zoom >= 11][zoom < 13], #admin-high-zoom[zoom >= 13] { [admin_level = '5'][zoom >= 11] { + background/line-join: bevel; background/line-color: white; background/line-width: 2; + line-join: bevel; line-color: @admin-boundaries; line-width: 2; line-dasharray: 6,3,2,3,2,3; line-clip: false; } [admin_level = '6'][zoom >= 11] { + background/line-join: bevel; background/line-color: white; background/line-width: 2; + line-join: bevel; line-color: @admin-boundaries; line-width: 2; line-dasharray: 6,3,2,3; @@ -88,8 +133,10 @@ overlapping borders correctly. [admin_level = '7'], [admin_level = '8'] { [zoom >= 12] { + background/line-join: bevel; background/line-color: white; background/line-width: 1.5; + line-join: bevel; line-color: @admin-boundaries; line-width: 1.5; line-dasharray: 5,2; @@ -104,8 +151,10 @@ overlapping borders correctly. [admin_level = '9'], [admin_level = '10'] { [zoom >= 13] { + background/line-join: bevel; background/line-color: white; background/line-width: 2; + line-join: bevel; line-color: @admin-boundaries; line-width: 2; line-dasharray: 2,3; diff --git a/placenames.mss b/placenames.mss index 6137660a3d..cef29d3328 100644 --- a/placenames.mss +++ b/placenames.mss @@ -1,18 +1,38 @@ @placenames: #222; @placenames-light: #777777; +@country-labels: darken(@admin-boundaries, 15%); +@state-labels: desaturate(darken(@admin-boundaries, 5%), 20%); .country { - [admin_level = '2'][zoom >= 2][way_pixels > 3000][way_pixels < 196000] { + [admin_level = '2'][zoom >= 3][way_pixels > 1000][way_pixels < 360000] { text-name: "[name]"; text-size: 9; - text-fill: #9d6c9d; + + [zoom >= 3] { + text-size: 10; + } + [zoom >= 4] { + text-size: 11; + } + [zoom >= 5] { + text-size: 12; + } + [zoom >= 7] { + text-size: 13; + } + [zoom >= 10] { + text-size: 14; + } + + text-fill: @country-labels; text-face-name: @book-fonts; + text-halo-fill: rgba(255,255,255,0.6); text-halo-radius: 1.5; - text-wrap-width: 50; + text-wrap-width: 35; text-placement: interior; - [zoom >= 4] { - text-size: 10; - } + text-character-spacing: 0.5; + text-min-distance: 3; + text-line-spacing: 1; } } @@ -22,18 +42,20 @@ [zoom >= 5][way_pixels > 3000][way_pixels < 196000] { text-name: "[ref]"; text-size: 9; - text-fill: #9d6c9d; + text-fill: @state-labels; text-face-name: @oblique-fonts; + text-halo-fill: rgba(255,255,255,0.6); text-halo-radius: 1.5; text-wrap-width: 0; text-placement: interior; + text-min-distance: 3; [zoom >= 5] { text-name: "[name]"; - text-wrap-width: 50; + text-wrap-width: 30; } [zoom >= 7] { text-size: 11; - text-wrap-width: 70; + text-wrap-width: 50; } } } @@ -41,7 +63,6 @@ #placenames-medium::high-importance { [category = 1][zoom < 14] { - [zoom >= 3][score >= 5000000], [zoom >= 4][score >= 3000000], [zoom >= 5][score >= 400000] { text-name: "[name]"; diff --git a/project.mml b/project.mml index ebce0cd83a..bcd10e550b 100644 --- a/project.mml +++ b/project.mml @@ -1056,7 +1056,7 @@ "srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over", "Datasource": { "extent": "-20037508,-20037508,20037508,20037508", - "table": "(SELECT\n way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4')\n ORDER BY admin_level DESC\n) AS admin_low_zoom", + "table": "(SELECT\n way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4')\n AND osm_id < 0\n ORDER BY admin_level DESC\n) AS admin_low_zoom", "geometry_field": "way", "type": "postgis", "key_field": "", @@ -1083,7 +1083,7 @@ "srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over", "Datasource": { "extent": "-20037508,-20037508,20037508,20037508", - "table": "(SELECT\n way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8')\n ORDER BY admin_level DESC\n) AS admin_mid_zoom", + "table": "(SELECT\n way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8')\n AND osm_id < 0\n ORDER BY admin_level DESC\n) AS admin_mid_zoom", "geometry_field": "way", "type": "postgis", "key_field": "", @@ -1110,7 +1110,7 @@ "srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over", "Datasource": { "extent": "-20037508,-20037508,20037508,20037508", - "table": "(SELECT\n way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10')\n ORDER BY admin_level::integer DESC -- With 10 as a valid value, we need to do a numeric ordering, not a text ordering\n) AS admin_high_zoom", + "table": "(SELECT\n way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10')\n AND osm_id < 0\n ORDER BY admin_level::integer DESC -- With 10 as a valid value, we need to do a numeric ordering, not a text ordering\n) AS admin_high_zoom", "geometry_field": "way", "type": "postgis", "key_field": "", diff --git a/project.yaml b/project.yaml index 28d7901b46..ffc17c88f5 100644 --- a/project.yaml +++ b/project.yaml @@ -1325,6 +1325,7 @@ Layer: FROM planet_osm_roads WHERE boundary = 'administrative' AND admin_level IN ('0', '1', '2', '3', '4') + AND osm_id < 0 ORDER BY admin_level DESC ) AS admin_low_zoom properties: @@ -1344,6 +1345,7 @@ Layer: FROM planet_osm_roads WHERE boundary = 'administrative' AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8') + AND osm_id < 0 ORDER BY admin_level DESC ) AS admin_mid_zoom properties: @@ -1364,6 +1366,7 @@ Layer: FROM planet_osm_roads WHERE boundary = 'administrative' AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10') + AND osm_id < 0 ORDER BY admin_level::integer DESC -- With 10 as a valid value, we need to do a numeric ordering, not a text ordering ) AS admin_high_zoom properties: diff --git a/shapefiles.mss b/shapefiles.mss index 5b3d1c0b72..1274b57a74 100644 --- a/shapefiles.mss +++ b/shapefiles.mss @@ -1,6 +1,12 @@ #necountries { [zoom >= 1][zoom < 4] { - line-width: 0.5; + line-width: 0.2; + [zoom >= 2] { + line-width: 0.3; + } + [zoom >= 3] { + line-width: 0.4; + } line-color: @admin-boundaries; } }