diff --git a/placenames.mss b/placenames.mss index e5e33db17e..1decda5110 100644 --- a/placenames.mss +++ b/placenames.mss @@ -4,7 +4,7 @@ @state-labels: desaturate(darken(@admin-boundaries, 5%), 20%); .country { - [admin_level = '2'][zoom >= 3][way_pixels > 1000][way_pixels < 360000] { + [zoom >= 3][way_pixels > 1000][way_pixels < 360000] { text-name: "[name]"; text-size: 10; [zoom >= 4] { @@ -31,56 +31,127 @@ } .state { - [admin_level = '4'] { - [zoom >= 4][zoom < 5][way_pixels > 750], - [zoom >= 5][way_pixels > 3000][way_pixels < 196000] { - text-name: "[ref]"; - text-size: 9; - text-fill: @state-labels; - text-face-name: @oblique-fonts; - text-halo-fill: @standard-halo-fill; - text-halo-radius: @standard-halo-radius * 1.5; - text-wrap-width: 0; - text-placement: interior; - [zoom >= 5] { - text-name: "[name]"; - text-wrap-width: 30; - } - [zoom >= 7] { - text-size: 11; - text-wrap-width: 50; - } + [zoom >= 4][zoom < 5][way_pixels > 750], + [zoom >= 5][way_pixels > 3000][way_pixels < 196000] { + text-name: "[ref]"; + text-size: 9; + text-fill: @state-labels; + text-face-name: @oblique-fonts; + text-halo-fill: @standard-halo-fill; + text-halo-radius: @standard-halo-radius * 1.5; + text-wrap-width: 0; + text-placement: interior; + [zoom >= 5] { + text-name: "[name]"; + text-wrap-width: 30; + } + [zoom >= 7] { + text-size: 11; + text-wrap-width: 50; + } + } +} + +#capital-names { + [zoom >= 4][zoom < 8][population > 600000], + [zoom >= 5][zoom < 8] { + shield-file: url('symbols/place/place-capital-6.svg'); + shield-text-dx: 6; + shield-text-dy: 6; + shield-name: '[name]'; + shield-face-name: @book-fonts; + shield-fill: @placenames; + shield-size: 11; + shield-margin: 5; + shield-avoid-edges: true; + shield-wrap-width: 30; + shield-halo-fill: @standard-halo-fill; + shield-halo-radius: @standard-halo-radius * 1.5; + shield-placement-type: simple; + shield-placements: 'S,N,E,W'; + [dir = 1] { + shield-placements: 'N,S,E,W'; + } + shield-unlock-image: true; + + [zoom >= 5] { + shield-wrap-width: 45; + } + [zoom >= 6] { + shield-size: 12; + shield-wrap-width: 60; + } + [zoom >= 7] { + shield-file: url('symbols/place/place-capital-8.svg'); + shield-text-dx: 7; + shield-text-dy: 7; + } + } + [zoom >= 8] { + text-name: '[name]'; + text-face-name: @book-fonts; + text-fill: @placenames; + text-size: 13; + text-margin: 6; + text-wrap-width: 60; + text-halo-fill: @standard-halo-fill; + text-halo-radius: @standard-halo-radius * 1.5; + + [zoom >= 11] { + text-size: 15; + text-wrap-width: 75; } } } #placenames-medium::high-importance { [category = 1][zoom < 14] { - [zoom >= 4][score >= 3000000], - [zoom >= 5][score >= 400000] { - text-name: "[name]"; - text-size: 11; - text-fill: @placenames; - text-face-name: @book-fonts; - text-halo-radius: @standard-halo-radius * 1.5; - text-halo-fill: @standard-halo-fill; - text-wrap-width: 30; + [zoom >= 4][zoom < 5][score >= 3000000], + [zoom >= 5][zoom < 8][score >= 400000] { + shield-file: url('symbols/place/place-4.svg'); + shield-text-dx: 4; + shield-text-dy: 4; + shield-name: '[name]'; + shield-face-name: @book-fonts; + shield-fill: @placenames; + shield-size: 11; + shield-margin: 5; + shield-avoid-edges: true; + shield-wrap-width: 30; + shield-halo-fill: @standard-halo-fill; + shield-halo-radius: @standard-halo-radius * 1.5; + shield-placement-type: simple; + shield-placements: 'S,N,E,W'; + [dir = 1] { + shield-placements: 'N,S,E,W'; + } + shield-unlock-image: true; + [zoom >= 5] { - text-size: 11; - text-wrap-width: 45; + shield-wrap-width: 45; } [zoom >= 6] { - text-size: 12; - text-wrap-width: 60; - } - [zoom >= 8] { - text-size: 13; - text-wrap-width: 60; + shield-size: 12; + shield-wrap-width: 60; + + shield-file: url('symbols/place/place-6.svg'); + shield-text-dx: 5; + shield-text-dy: 5; } - [zoom >= 9] { - text-size: 14; - text-wrap-width: 65; + [zoom >= 7] { + shield-file: url('symbols/place/place-6-z7.svg'); } + } + [zoom >= 8][score >= 400000] { + text-name: '[name]'; + text-face-name: @book-fonts; + text-fill: @placenames; + text-size: 13; + text-margin: 6; + text-wrap-width: 60; + text-halo-fill: @standard-halo-fill; + text-halo-radius: @standard-halo-radius * 1.5; + [zoom >= 11] { text-size: 15; text-wrap-width: 75; @@ -91,15 +162,39 @@ #placenames-medium::medium-importance { [category = 1][score < 400000][zoom < 15] { - [zoom >= 6][score >= 70000], - [zoom >= 7] { + [zoom >= 6][zoom < 8][score >= 70000], + [zoom >= 7][zoom < 8] { + shield-file: url('symbols/place/place-4.svg'); + shield-text-dx: 4; + shield-text-dy: 4; + shield-name: "[name]"; + shield-size: 10; + shield-fill: @placenames; + shield-face-name: @book-fonts; + shield-halo-fill: @standard-halo-fill; + shield-halo-radius: @standard-halo-radius * 1.5; + shield-wrap-width: 30; + shield-margin: 5; + shield-avoid-edges: true; + shield-placement-type: simple; + shield-placements: 'S,N,E,W'; + [dir = 1] { + shield-placements: 'N,S,E,W'; + } + shield-unlock-image: true; + [zoom >= 7] { + shield-file: url('symbols/place/place-4-z7.svg'); + } + } + [zoom >= 8] { text-name: "[name]"; text-size: 10; text-fill: @placenames; text-face-name: @book-fonts; - text-halo-radius: @standard-halo-radius * 1.5; text-halo-fill: @standard-halo-fill; - text-wrap-width: 30; + text-halo-radius: @standard-halo-radius * 1.5; + text-wrap-width: 60; + text-margin: 6; [zoom >= 9] { text-size: 12; text-wrap-width: 60; @@ -123,9 +218,10 @@ text-size: 10; text-fill: @placenames; text-face-name: @book-fonts; - text-halo-radius: @standard-halo-radius * 1.5; text-halo-fill: @standard-halo-fill; + text-halo-radius: @standard-halo-radius * 1.5; text-wrap-width: 45; + text-margin: 6; [zoom >= 11] { text-size: 11; text-wrap-width: 55; @@ -148,8 +244,8 @@ text-size: 11; text-fill: @placenames; text-face-name: @book-fonts; - text-halo-radius: @standard-halo-radius * 1.5; text-halo-fill: @standard-halo-fill; + text-halo-radius: @standard-halo-radius * 1.5; text-wrap-width: 55; [zoom >= 14] { text-size: 14; @@ -171,8 +267,8 @@ text-size: 10; text-fill: @placenames; text-face-name: @book-fonts; - text-halo-radius: @standard-halo-radius * 1.5; text-halo-fill: @standard-halo-fill; + text-halo-radius: @standard-halo-radius * 1.5; text-wrap-width: 50; [zoom >= 14] { text-fill: @placenames-light; @@ -199,8 +295,8 @@ text-size: 10; text-fill: @placenames; text-face-name: @book-fonts; - text-halo-radius: @standard-halo-radius * 1.5; text-halo-fill: @standard-halo-fill; + text-halo-radius: @standard-halo-radius * 1.5; text-wrap-width: 45; } [zoom >= 16] { @@ -211,3 +307,4 @@ } } } + diff --git a/project.mml b/project.mml index f164e78847..b0d35a5bd7 100644 --- a/project.mml +++ b/project.mml @@ -1258,15 +1258,15 @@ "advanced": {} }, { - "name": "placenames-large", + "name": "country-names", "srs-name": "900913", "geometry": "point", - "class": "country state", - "id": "placenames-large", + "class": "country", + "id": "country-names", "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 way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,\n name,\n ref,\n admin_level\n FROM planet_osm_polygon\n WHERE boundary = 'administrative'\n AND admin_level IN ('2', '4')\n AND name IS NOT NULL\n AND way_area > 750*!pixel_width!::real*!pixel_height!::real -- only labels for larger areas are displayed\n ORDER BY admin_level ASC, way_area DESC\n) AS placenames_large", + "table": "(SELECT\n way,\n way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,\n name\n FROM planet_osm_polygon\n WHERE boundary = 'administrative'\n AND admin_level = '2'\n AND name IS NOT NULL\n AND way_area > 100*!pixel_width!::real*!pixel_height!::real\n ORDER BY way_area DESC\n) AS country_names", "geometry_field": "way", "type": "postgis", "key_field": "", @@ -1280,6 +1280,58 @@ ], "properties": { "minzoom": 2 + } + }, + { + "name": "capital-names", + "srs-name": "900913", + "geometry": "point", + "class": "", + "id": "capital-names", + "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 name,\n CASE\n WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER ELSE 0\n END as population,\n round(random()) AS dir\n FROM planet_osm_point\n WHERE capital = 'yes'\n AND admin_level = '2'\n ORDER BY population DESC\n) AS capital_names", + "geometry_field": "way", + "type": "postgis", + "key_field": "", + "dbname": "gis" + }, + "extent": [ + -180, + -85.05112877980659, + 180, + 85.05112877980659 + ], + "properties": { + "maxzoom": 15, + "minzoom": 3 + }, + "advanced": {} + }, + { + "name": "state-names", + "srs-name": "900913", + "geometry": "point", + "class": "state", + "id": "state-names", + "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 way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,\n name,\n ref\n FROM planet_osm_polygon\n WHERE boundary = 'administrative'\n AND admin_level = '4'\n AND name IS NOT NULL\n AND way_area > 100*!pixel_width!::real*!pixel_height!::real\n ORDER BY way_area DESC\n) AS state_names", + "geometry_field": "way", + "type": "postgis", + "key_field": "", + "dbname": "gis" + }, + "extent": [ + -180, + -85.05112877980659, + 180, + 85.05112877980659 + ], + "properties": { + "minzoom": 4 }, "advanced": {} }, @@ -1292,7 +1344,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 name,\n score,\n CASE\n WHEN (place = 'city' OR (capital = 'yes' AND score >= 100000)) THEN 1\n ELSE 2\n END as category\n FROM \n (SELECT\n way,\n place,\n name,\n capital,\n (\n (CASE\n WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER\n WHEN (place = 'city') THEN 100000\n WHEN (place = 'town') THEN 1000\n ELSE 1\n END)\n *\n (CASE\n WHEN (capital = 'yes') THEN 3\n WHEN (capital = '4') THEN 2\n ELSE 1\n END)\n ) AS score\n FROM planet_osm_point\n WHERE place IN ('city', 'town')\n AND name IS NOT NULL\n ) as p\n ORDER BY score DESC, length(name) DESC, name\n) AS placenames_medium", + "table": "(SELECT\n way,\n name,\n score,\n CASE\n WHEN (place = 'city') THEN 1\n ELSE 2\n END as category,\n round(random()) AS dir\n FROM \n (SELECT\n way,\n place,\n name,\n (\n (CASE\n WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER\n WHEN (place = 'city') THEN 100000\n WHEN (place = 'town') THEN 1000\n ELSE 1\n END)\n *\n (CASE\n WHEN (capital = '4' OR (capital = 'yes' AND admin_level = '4')) THEN 2\n ELSE 1\n END)\n ) AS score\n FROM planet_osm_point\n WHERE place IN ('city', 'town')\n AND name IS NOT NULL\n AND capital IS NULL OR capital != 'yes' OR (capital = 'yes' AND admin_level != '2')\n ) as p\n ORDER BY score DESC, length(name) DESC, name\n) AS placenames_medium", "geometry_field": "way", "type": "postgis", "key_field": "", diff --git a/project.yaml b/project.yaml index 98b4b782ed..0b83940a30 100644 --- a/project.yaml +++ b/project.yaml @@ -1490,9 +1490,9 @@ Layer: properties: minzoom: 16 advanced: {} - - id: "placenames-large" - name: "placenames-large" - class: "country state" + - id: "country-names" + name: "country-names" + class: "country" geometry: "point" <<: *extents Datasource: @@ -1501,18 +1501,62 @@ Layer: (SELECT way, way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels, - name, - ref, - admin_level + name FROM planet_osm_polygon WHERE boundary = 'administrative' - AND admin_level IN ('2', '4') + AND admin_level = '2' AND name IS NOT NULL - AND way_area > 750*!pixel_width!::real*!pixel_height!::real -- only labels for larger areas are displayed - ORDER BY admin_level ASC, way_area DESC - ) AS placenames_large + AND way_area > 100*!pixel_width!::real*!pixel_height!::real + ORDER BY way_area DESC + ) AS country_names properties: minzoom: 2 + - id: "capital-names" + name: "capital-names" + class: "" + geometry: "point" + <<: *extents + Datasource: + <<: *osm2pgsql + table: |- + (SELECT + way, + name, + CASE + WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER ELSE 0 + END as population, + round(random()) AS dir + FROM planet_osm_point + WHERE capital = 'yes' + AND admin_level = '2' + ORDER BY population DESC + ) AS capital_names + properties: + minzoom: 3 + maxzoom: 15 + advanced: {} + - id: "state-names" + name: "state-names" + class: "state" + geometry: "point" + <<: *extents + Datasource: + <<: *osm2pgsql + table: |- + (SELECT + way, + way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels, + name, + ref + FROM planet_osm_polygon + WHERE boundary = 'administrative' + AND admin_level = '4' + AND name IS NOT NULL + AND way_area > 100*!pixel_width!::real*!pixel_height!::real + ORDER BY way_area DESC + ) AS state_names + properties: + minzoom: 4 advanced: {} - id: "placenames-medium" name: "placenames-medium" @@ -1527,15 +1571,15 @@ Layer: name, score, CASE - WHEN (place = 'city' OR (capital = 'yes' AND score >= 100000)) THEN 1 + WHEN (place = 'city') THEN 1 ELSE 2 - END as category + END as category, + round(random()) AS dir FROM (SELECT way, place, name, - capital, ( (CASE WHEN (population ~ '^[0-9]{1,8}$') THEN population::INTEGER @@ -1545,14 +1589,14 @@ Layer: END) * (CASE - WHEN (capital = 'yes') THEN 3 - WHEN (capital = '4') THEN 2 + WHEN (capital = '4' OR (capital = 'yes' AND admin_level = '4')) THEN 2 ELSE 1 END) ) AS score FROM planet_osm_point WHERE place IN ('city', 'town') AND name IS NOT NULL + AND capital IS NULL OR capital != 'yes' OR (capital = 'yes' AND admin_level != '2') ) as p ORDER BY score DESC, length(name) DESC, name ) AS placenames_medium diff --git a/symbols/place/place-4-z7.svg b/symbols/place/place-4-z7.svg new file mode 100644 index 0000000000..4130e8d12a --- /dev/null +++ b/symbols/place/place-4-z7.svg @@ -0,0 +1,30 @@ + + + + + + + image/svg+xml + + + + + + + diff --git a/symbols/place/place-4.svg b/symbols/place/place-4.svg new file mode 100644 index 0000000000..11504018fa --- /dev/null +++ b/symbols/place/place-4.svg @@ -0,0 +1,30 @@ + + + + + + + image/svg+xml + + + + + + + diff --git a/symbols/place/place-6-z7.svg b/symbols/place/place-6-z7.svg new file mode 100644 index 0000000000..c4fe4efeb3 --- /dev/null +++ b/symbols/place/place-6-z7.svg @@ -0,0 +1,30 @@ + + + + + + + image/svg+xml + + + + + + + diff --git a/symbols/place/place-6.svg b/symbols/place/place-6.svg new file mode 100644 index 0000000000..e0abe6da97 --- /dev/null +++ b/symbols/place/place-6.svg @@ -0,0 +1,30 @@ + + + + + + + image/svg+xml + + + + + + + diff --git a/symbols/place/place-capital-6.svg b/symbols/place/place-capital-6.svg new file mode 100644 index 0000000000..645aeb5b37 --- /dev/null +++ b/symbols/place/place-capital-6.svg @@ -0,0 +1,34 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/symbols/place/place-capital-8.svg b/symbols/place/place-capital-8.svg new file mode 100644 index 0000000000..e385e1a1cf --- /dev/null +++ b/symbols/place/place-capital-8.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + + +