Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to placename rendering #2314

Merged
merged 5 commits into from
Sep 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 145 additions & 48 deletions placenames.mss
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand All @@ -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] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that all capitals are rendered up to z15 inclusive (as max-zoom in yaml file declares)?

If so, might it be possible to let vanish big capitals with high population count (Rome, Berlin) earlier, while small capitals (Monaca, Andorra le Vella) valish later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be a good idea. I'm just not sure if I still want to squeeze that in. Comparing to the status quo: big capitals vanish one zoom level later, smaller capitals may vanish earlier. I leave it to the maintainers to decide if they require changes to that.

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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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] {
Expand All @@ -211,3 +307,4 @@
}
}
}

62 changes: 57 additions & 5 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand All @@ -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": {}
},
Expand All @@ -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": "",
Expand Down
Loading