Is there a way to filter by name
tag?
#638
-
Hi all and thanks for planetiler. Let me provide some context: I want to build a map including a layer for, for instance, rivers but I would like to include only some of the rivers, the longer ones, and avoid the rest. For instance, for Germany would be something like Danube, Elbe, Rhine, Oder. Is it possible doing so by filtering using something like I've made several attempts using Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Yes, if you are using custommap with YAML you can write a boolean expression for |
Beta Was this translation helpful? Give feedback.
-
Hi @bdon I've tried several variations similar to: [...]
- id: water_lines
features:
- source: osm
geometry: line
min_zoom: 8
include_when:
waterway:
- river
name:
- "Río Ebro"
- "Río Tajo"
attributes:
- key: kind
type: match_value
[...] (*) 'Río' is river in spanish. In the meantime I've tried to use pyosmium to get the rivers layer as an *.osm.pbf file and then use planetiler to create the final *.pmtiles file. Something like this in the sources: sources:
water_polygons:
type: shapefile
url: https://osmdata.openstreetmap.de/download/water-polygons-split-4326.zip
admin_points:
type: shapefile
url: https://shortbread.geofabrik.de/shapefiles/admin-points-4326.zip
osm:
type: osm
url: geofabrik:spain
osm2:
type: osm
local_path: data/source/my_rivers.osm.pbf but it seems planetiler only can manage one *.osm.pbf file at this moment. If I can't accomplish what I need using a custom YAML I could get the customised "rivers" layer as a Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
Ok, I think I found the way to do it after many 'trial and error' methodology 😅 : [...]
include_when:
__all__:
waterway:
- river
name:
- "Río Ebro"
- "Río Tajo"
[...] I think now I understand a little bit how the expressions work. It would be great if someone can confirm if this is the canonical way to proceed. When I find some time I will try to provide some examples in order to help others to better understand how to create their custom maps. |
Beta Was this translation helpful? Give feedback.
Ok, I think I found the way to do it after many 'trial and error' methodology 😅 :
I think now I understand a little bit how the expressions work.
It would be great if someone can confirm if this is the canonical way to proceed.
When I find some time I will try to provide some examples in order to help others to better understand how to create their custom maps.