On Mapbox, Leaflet, and Turf.js
The past year I’ve worked a lot with Google Maps. I thought Google Maps were awesome. They seem to know about every “Place” on the planet! So I was a little shy about having to use Mapbox for some front-end map manipulation.
I began by having a look around their API documentation available here. I saw a lot of things that I had no clue about. TileLayers, GridLayers, Controls, and a bunch of utils. It wasn’t until I had spent the better part of 2 days trying to build a type of geofence manager using it that I really understood how powerful these tools are.
It seems like someone out there in the open-source community has solved every problem I come across. I needed to allow users to draw some polygons on the map - Leaflet.draw will help you with that!
I then needed to perform some operations on groups of polygons, so using a standard JSON format called GeoJSON, I can pass my polygons to Turf.js and use their awesome GIS library to perform things like intersections, and merging of polygons.
Overall, in a few short days I have come to really like this open-souce community who work with GIS libraries. Turf even have super fast response times to GitHub issues!
If you enjoyed this post, please check out my other blog posts.