Skip to content

Add distinc symbolizer for capital cities #488

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion render-tests/run_render_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function getTestStyles(options: RenderOptions, directory: string): StyleWithTest
lang: 'en',
recycleMap: options.recycleMap || false,
allowed: 0.00025,
threshold: 0.1285,
threshold: 0.05,
...style.metadata.test
};

Expand Down
Binary file modified render-tests/tests/buildings/railway/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion render-tests/tests/buildings/railway/style.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"test": {
"width": 256,
"height": 256,
"flavor": "light",
"flavor": "black",
"lang": "en"
},
"link": "https://github.com/protomaps/basemaps/issues/249"
Expand Down
Binary file modified render-tests/tests/earth/minsize/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified render-tests/tests/landuse/grassland/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified render-tests/tests/places/athens/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added render-tests/tests/places/capital/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added render-tests/tests/places/capital/input.osm.pbf
Binary file not shown.
17 changes: 17 additions & 0 deletions render-tests/tests/places/capital/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": 8,
"metadata": {
"test": {
"width": 256,
"height": 256,
"flavor": "light",
"lang": "en"
},
"link": "https://github.com/protomaps/basemaps/issues/439"
},
"center": [
8.073,
47.021
],
"zoom": 6
}
Binary file modified render-tests/tests/places/rome-vatican/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified render-tests/tests/places/variable-anchor/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified render-tests/tests/water/fountain/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sprites/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ fn extract_groups_from_svg(
substr = "townspot".to_string();
}

if substr == "capital-s" {
substr = "capital".to_string();
}

if !shader.icons.contains_key(&substr) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion sprites/themes/black.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"base":["#aaaaaa","#000000"]
},
"icons": {
"townspot":"base"
"townspot":"base",
"capital":"base"
}
}
1 change: 1 addition & 0 deletions sprites/themes/dark.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"icons": {
"townspot":"base",
"capital":"base",
"beach":"green",
"forest":"green",
"marina":"green",
Expand Down
3 changes: 2 additions & 1 deletion sprites/themes/grayscale.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"base":["#444444","#dddddd"]
},
"icons": {
"townspot":"base"
"townspot":"base",
"capital":"base"
}
}
1 change: 1 addition & 0 deletions sprites/themes/light.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"icons": {
"townspot":"base",
"capital":"base",
"beach":"green",
"forest":"green",
"marina":"green",
Expand Down
3 changes: 2 additions & 1 deletion sprites/themes/white.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"base":["#888888","#ffffff"]
},
"icons": {
"townspot":"base"
"townspot":"base",
"capital":"base"
}
}
8 changes: 7 additions & 1 deletion styles/src/base_layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,13 @@ export function labels_layers(
"source-layer": "places",
filter: ["==", "kind", "locality"],
layout: {
"icon-image": ["step", ["zoom"], "townspot", 8, ""],
"icon-image": [
"step",
["zoom"],
["case", ["==", ["get", "capital"], "yes"], "capital", "townspot"],
8,
"",
],
"icon-size": 0.7,
"text-field": get_multiline_name(
lang,
Expand Down
Loading