Skip to content

Instantly share code, notes, and snippets.

@hfu
Created February 19, 2019 21:29
Show Gist options
  • Save hfu/769f36044769da1c4888ce251411f489 to your computer and use it in GitHub Desktop.
Save hfu/769f36044769da1c4888ce251411f489 to your computer and use it in GitHub Desktop.
a part of style.json from onyx-tapioca
{
"id": "pt-place",
"type": "symbol",
"source": "vstd",
"source-layer": "place",
"filter": [
"all",
[
"==",
"$type",
"Point"
]
],
"layout": {
"icon-image": [
"case",
["==", ["get", "capital"], "yes"],
"national_capital",
[
"match",
[
"coalesce",
["get", "place"],
["get", "leasure"],
["get", "sports"],
["get", "amenity"],
["get", "historic"],
["get", "military"],
["get", "office"],
["get", "craft"],
["get", "tourism"],
["get", "shop"]
],
"stadium", "stadium",
"sports_centre", "sport",
"park", "park",
"tennis", "sport",
"public_building", "public_building",
"townhall", "public_building",
"embassy", "embassy",
"courthouse", "courthouse",
"police", "police_station",
"prison", "prison",
"fire_station", "fire_station",
"post_office", "post_office",
"school", "school",
"college", "college",
"university", "college",
"hospital", "hospital",
"fuel", "fuel",
"airport", "airport",
"ferry_terminal", "ferry_terminal",
"restaurant", "restaurant",
"fast_food", "restaurant",
"cafe", "restaurant",
"food_court", "restaurant",
"biergarten", "bar",
"nightclub", "bar",
"pub", "bar",
"bar", "bar",
"community_centre", "other_public_building",
"cinema", "commercial",
"library", "public_building",
"arts_centre", "public_building",
"money_transfer", "bank",
"bureau_de_change", "bank",
"theatre", "commercial",
"grave_yard", "memorial",
"bank", "bank",
"atm", "bank",
"marketplace", "commercial",
"car_rental", "commercial",
"pharmacy", "pharmacy",
"drinking_water", "water_supply",
"bus_station", "bus_station",
"monument", "memorial",
"memorial", "memorial",
"castle", "castle",
"fort", "castle",
"archaeological_site", "public_building",
"ruins", "public_building",
"airfield", "airfield",
"government", "other_public_building",
"ngo", "ngo",
"bakery", "commercial",
"bed_and_breakfast", "hotel",
"hotel", "hotel",
"motel", "hotel",
"guest_house", "hotel",
"hostel", "hotel",
"chalet", "hotel",
"museum", "public_building",
"zoo", "zoo",
"theme_park", "theme_park",
"car_repair", "commercial",
"supermarket", "commercial",
"kiosk", "commercial",
"department_store", "commercial",
"clothes", "commercial",
"books", "commercial",
"butcher", "commercial",
"beverages", "commercial",
"alcohol", "commercial",
"optician", "commercial",
"stationery", "commercial",
"mobile_phone", "commercial",
"greengrocer", "commercial",
"car", "commercial",
"furniture", "commercial",
"computer", "commercial",
"hairdresser", "commercial",
"travel_agency", "commercial",
"default"
]
],
"icon-size": [
"step",
["zoom"],
[
"case",
["==", ["get", "capital"], "yes"],
1,
[
"case",
["has", "place"],
0,
[
"case",
[
"any",
["has", "shop"],
["has", "tourism"],
["has", "craft"],
["has", "amenity"],
["has", "sports"]
],
0,
1
]
]
],
17,
1
],
"text-field": [
"step",
["zoom"],
[
"case",
["has", "place"],
["get", "name"],
""
],
18,
["get", "name"]
],
"text-anchor": [
"step",
["zoom"],
[
"match",
["get", "capital"],
"yes",
"bottom-left",
"center"
],
18,
"top"
],
"text-offset": [
"step",
["zoom"],
[
"match",
["get", "capital"],
"yes",
["literal", [0.4, 0]],
["literal", [0, 0]]
],
18,
["literal", [0, 1]]
],
"text-font": [ "sans" ],
"text-size": [
"step",
["zoom"],
[
"case",
["==", ["get", "capital"], "yes"],
18,
[
"match",
[
"coalesce",
["get", "place"]
],
"city", 16,
"town", 12,
"village", 11,
"hamlet", 11,
"isolated_dwelling", 11,
"locality", 11,
14
]
],
18,
9
]
},
"paint": {
"text-color": "rgb(0, 0, 0)",
"text-halo-color": "rgb(238, 238, 238)",
"text-halo-width": 1
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment