Skip to content

Instantly share code, notes, and snippets.

@crazycapivara
Created June 13, 2019 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crazycapivara/5efd362173604e25b985ce1cf68f2dad to your computer and use it in GitHub Desktop.
Save crazycapivara/5efd362173604e25b985ce1cf68f2dad to your computer and use it in GitHub Desktop.
function getStyle(feature, resolution) {
var color = "green";
const name = feature.get("name");
if (name.startsWith("A ")) color = "blue";
else if (name.startsWith("L ")) color = "red";
return new ol.style.Style({
stroke: new ol.style.Stroke({
color: color,
width: 2
})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment