-
I am revising MapLibre GL styles that are used in my projects and it is not very clear to me how Example case:
Similar seems to happen on data source as used in maptiler.com (not sure if they use Planetiler or older import scripts). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Those come from processing openmaptiles yaml files, for example this file tells openmaptiles and planetiler-openmaptiles which elements to choose, and how to map the tags from those elements to columns in intermediate sql tables: https://github.com/openmaptiles/openmaptiles/blob/master/layers/poi/mapping.yaml For - name: subclass
type: mapping_value
- name: mapping_key
type: mapping_key Then this file groups certain values from the values:
shop:
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
'coffee', 'computer', 'convenience', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
'erotic', 'electronics', 'fabric', 'florist', 'frozen_food', 'furniture', 'video_games', 'video',
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'ice_cream', 'interior_decoration',
'jewelry', 'kiosk', 'locksmith', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone',
'newsagent', 'optician', 'outdoor', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand',
'shoes', 'sports', 'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency',
'watches', 'weapons', 'wholesale']
town_hall: The planetiler-openmaptiles repo has a script that compiles those yaml scripts to java code: public static final Expression MAPPING = and(or(...
matchAny("shop", "accessories", "alcohol", "antiques", "art", "bag", "bakery", "beauty", "bed", "beverages",
"bicycle", "books", "boutique", "butcher", "camera", "car", "car_repair", "car_parts", "carpet", "charity",
"chemist", "chocolate", "clothes", "coffee", "computer", "confectionery", "convenience", "copyshop",
"cosmetics", "deli", "delicatessen", "department_store", "doityourself", "dry_cleaning", "electronics",
"erotic", "fabric", "florist", "frozen_food", "furniture", "garden_centre", "general", "gift", "greengrocer",
"hairdresser", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk",
"lamps", "laundry", "locksmith", "mall", "massage", "mobile_phone", "motorcycle", "music", "musical_instrument",
"newsagent", "optician", "outdoor", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes", "sports",
"stationery", "supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "video",
"video_games", "watches", "weapons", "wholesale", "wine")), matchType("point")); final class FieldMappings {
public static final MultiExpression<String> Class = MultiExpression.of(List.of(
MultiExpression.entry("shop",
matchAny("subclass", "accessories", "antiques", "beauty", "bed", "boutique", "camera", "carpet", "charity",
"chemist", "coffee", "computer", "convenience", "copyshop", "cosmetics", "garden_centre", "doityourself",
"erotic", "electronics", "fabric", "florist", "frozen_food", "furniture", "video_games", "video", "general",
"gift", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk",
"locksmith", "lamps", "mall", "massage", "motorcycle", "mobile_phone", "newsagent", "optician", "outdoor",
"perfumery", "perfume", "pet", "photo", "second_hand", "shoes", "sports", "stationery", "tailor", "tattoo",
"ticket", "tobacco", "toys", "travel_agency", "watches", "weapons", "wholesale")),
MultiExpression.entry("town_hall",
matchAny("subclass", "townhall", "public_building", "courthouse", "community_centre")), ...);
} If you think you found an issue, I'd suggest fixing it in the openmaptiles repo yaml files, then on the next version upgrade planetiler-openmaptiles will get that fix automatically. Or you could add logic that falls back to setting the class to |
Beta Was this translation helpful? Give feedback.
Those come from processing openmaptiles yaml files, for example this file tells openmaptiles and planetiler-openmaptiles which elements to choose, and how to map the tags from those elements to columns in intermediate sql tables:
https://github.com/openmaptiles/openmaptiles/blob/master/layers/poi/mapping.yaml
For
shop=hairdresser
,hairdresser
is a value it extracts forshop
attribute, then these lines map the key that produced the match (shop
) to themapping_key
column and value (hairdresser
) to thesubclass
column which gets passed through to the output:https://github.com/openmaptiles/openmaptiles/blob/cd77b07e469b8f7726c286723e81d4b24ff7d5cc/layers/poi/mapping.yaml#L341-L344