Skip to content

Instantly share code, notes, and snippets.

@zoutepopcorn
Last active January 21, 2019 08:05
Show Gist options
  • Save zoutepopcorn/f562669b3c8af032446920ab6ccdccb9 to your computer and use it in GitHub Desktop.
Save zoutepopcorn/f562669b3c8af032446920ab6ccdccb9 to your computer and use it in GitHub Desktop.
clean circle
map.addSource("mysource", mySource)
map.addLayer({
"id": "hunter-circle",
"type": "circle",
"source": "mysource",
"paint": {
"circle-opacity": ['get', 'opacity'],
"circle-stroke-color": ['get', 'stroke'],
"circle-color": ['get', 'color'],
"circle-radius": ["interpolate", ["exponential", 2.0], ["zoom"], 0.0, 0.0, 20.0, ["get", "stopper"]]
},
"filter": ["==", "group", "inner"],
});
const metersToPixelsAtMaxZoom = (meters, latitude) => meters / 0.075 / Math.cos(latitude * Math.PI / 180)
let mySource = {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
'properties': {
'color': "#f00",
'stroke': "#fff",
'group': 'inner',
'test' : 100,
'opacity': 0.5,
'stopper' : metersToPixelsAtMaxZoom( 10, 52)
},
"geometry": {
"type": "Point",
"coordinates": [5,52]
}
}]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment