Leaflet – A JavaScript library for mobile-friendly interactive maps
leafletjs.com
leafletjs.com
I've been a little worried about Leaflet's future vs. Mapbox GL JS. That's also an excellent open source map library, but is based entirely on new technology (vector maps and GL) and favors using Mapbox's paid services. I think Leaflet has a long life ahead for folks who want something simpler, something that can easily composite raster data from many sources.
[1] https://blog.mapbox.com/mapbox-%EF%B8%8F-leaflet-d60b1be9661...
It was however also made by the creator of Leaflet, who works for Mapbox.
Thanks to tools like Maputnik, tippecanoe, and TileServer GL, I also had no problems using Mapbox GL and vector tiles without once touching a Mapbox service.
I still use Leaflet for most raster and simple vector maps simply because it is light and modular enough that I can get what I want, but the open source tools are there to reap the good stuff from Mapbox GL while avoiding the proprietary bits of Mapbox.
They always lack behind and try to force the React lifecycle and composition onto the library. Often this leads to leaking abstractions, which get uglier and uglier with time. Updating is also not a charm.
I stopped using them and simply build one component as facade, then use props as interfaces to the lib while letting the lib do its thing the way it wants behind that component.
I think there's something to be said for doing it yourself, particularly when the available options make you have to care about their internals anyway. But perhaps some of that effort might be put towards making a better open-source wrapper.
<3P.Wrapper>
<3P.Foo>
<3P.Bar
subcomponent={props}
/>
</3P.Foo>
{ someCondition ?
<3P.Quux
onCrunch={doQuack}{
/>
}
</3P.Wrapper>
where mounting and unmounting those child components interacts with the wrapped API. Contrast that with <3P.BasicWrapper
useFoo
useBar
useQuux={someCondition}
onQuuxCrunch={doQuack}
/>
which is less suitable for generic use, but easy enough to write (and modify later) that you probably don't need a highly-generic wrapper.Am I missing something? I love Leaflet, but I thought it was already one of the standards for maps on the web.
We wound up using Leaflet to handle everything else but the imagery is all from Bing Maps instead. I've run into edge cases I've had to figure out with Leaflet, but at least the JS ecosystem is big enough to where you can always find generic solutions that work with the existing mapping library.
This is a massive oversimplification, but roughly, one way of thinking of it is that leaflet is more suited to consumer-facing web maps and openlayers is more appropriate for heavy gis workloads; e.g. a web app for visualising business locations worldwide vs a web app for manipulating SHP data and EPSG projections.
That's not to say Leaflet can't be used for the latter -- e.g. in combination with some other tools like turf -- but OL is being developed with this kind of stuff on mind.
Plenty of cases where either choice is the right one, IMO.