Search code examples
geojsonmapbox-gl-jsmercator

How to generate a polygon around a GeoJson point in web mercator projection


I am building a tool to display markers on a map at varying heights in Mapbox GL Js. Mapbox currently lacks the ability to give a marker a height, and the geoJson point is not rendered on its own.

How can I generate a hexagon around a GeoJson point that will follow the EPSG:3857 projection, for me to render on my map?


Solution

  • I found that Turf.js was all I needed. There is a circle method that will generate a polygon around a point taking in a number of steps and radius.