I have a csv file with a set of coordinates with the following structure:
id,name,latitude,longitude
(24 values).
Those 24 points represent coordinates in a city. I would like to get a voronoi map with those coordinates as centroids, and then colour the polygons as if it were a choropleth map. The result of this will be a map to be published on a web dashboard, so I will be using js-only frameworks.
I've been following this tutorial and this example (leaflet+voronoi), but it's hard to find:
- Tutorials with current/modern versions of d3 and/or leaflet.
- Tutorials or articles on how to do the mapping process I need (coordinates>voronoi>choropleth).
Currently I am following the d3.voronoi section in the d3 API docs in order to understand how to generate the regions/polygons, but I don't know how to process those in order to generate the choropleth map using leaflet and mapbox.
turf.voronoi
on afeatureCollection
composed by the points previously described, then adding the polygons to a layer with leaflet geoJSON. You can see it here, methodsvoronoi
andaddVoronoiLayer
(it's far from perfect but it works). Hope this helps @duxk.gh.