Skip to content

Instantly share code, notes, and snippets.

@cladjidane
Last active June 10, 2021 06:52
Show Gist options
  • Save cladjidane/9870d941a8ea3524f4c3e443f3dde28f to your computer and use it in GitHub Desktop.
Save cladjidane/9870d941a8ea3524f4c3e443f3dde28f to your computer and use it in GitHub Desktop.
/* Permet de filtrer les features d'un layer pour affecter leur parametres */
/* Il est possible avec ça de masquer que les feature.properties.cat = "cat1" */
// https://stackoverflow.com/questions/59181258/how-to-use-mapbox-expressions-to-toggle-layer-class-styles/59185488#59185488
map.setLayoutProperty("points", "icon-image", [
"match", // Si match
["get", "id"], // properties.id
e.features[0].properties.id, // est égal à une variable passée, ici via un click sur une feature
"hu-motorway-2", // On défini l'option "Icon Image" avec cette valeur
"hu-main-2", // Si non on utilise celle là
]
);
@cladjidane
Copy link
Author

cladjidane commented Oct 13, 2020

J'ai essayé de filtrer sur l'attribut "id" au dessus de "properties" ... sans succès.
J'ai essayé ça
map.setPaintProperty("game_step", "circle-radius", [ "case", ["==", ["id"], stepAfter.id], 40, 5, ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment