Live data from Hacker News

LeafletJS: a JavaScript library for interactive maps

leafletjs.com

51–60 of 91 posts

Re: LeafletJS: a JavaScript library for interactive maps

#51

Just a heads up, if you are looking into using this in your project: The popup onclick triggers are currently broken in the latest version under Safari, using an older version solves it. Other than that this is an awesome library with tons of great plugins that I’ve used for years now.

A couple others that may bite:

1. Rotation not supported.

2. Debug source (leaflet-src.is) reports stale number: “1.6.0” for 1.7.1

Re: LeafletJS: a JavaScript library for interactive maps

#52
post #5

Earlier quoted context omitted.

When I used it, I really wished it used JS inheritance rather than its own custom inheritance/mixins.

JavaScript inheritance wasn't really a thing when Leaflet started out, and definitely not widely-supported (is it even now?).

Last I checked, IE11 is the last official holdout (with bugfixes and support) and it has less than 5% marketshare. That gives ES6 somewhere close to 95% marketshare for users that aren't running 3-6 year old insecure and outdated browsers.

Re: LeafletJS: a JavaScript library for interactive maps

#53
The first time I used it was to map parks and facilities for a state parks department, must have been in the early 2010s?

The design and data called for thousands of nested POIs all searchable by a range of filters (facilities, activities, etc), with pop-up info boxes and automatic clustering groups, with a custom layer from their XML-based geoserver full of park boundaries (polygons) which could filter the POIs within. By design this all required a round-trip to their geoserver which did a spatial query. The specification pushed one of the more popular JS mapping heavyweights of the day (I forget which) which due to the specific mix of required features ended up being painful, slow, janky, and with mobile-responsive becoming the frontend de-jure, a battle against nested layers of opinionated templating abstractions, all of which added up to a couple of hundred KB of dependencies and endless fragile callback-induced race-conditions, slow round-trips to their geoserver, and XML parsing issues. The mapping became a blocker on the project as the weeks wore on - hammer down one gopher, and another head would pop up. Design compromises were being considered to get the job over the line.

Enter Leaflet which was considered risky and new at the time, but on a whim and my own time I threw together a quick demo and got permission to spend a few days on it. I replaced weeks of frustrating spaghetti code and rebuilt a faster and more stable solution in a couple of days, polished it up after getting the "nod" and the site was finally ready to launch a couple of days later. Leaflet enabled the solution by being compact, only did the thing it was designed to do and didn't interfere elsewhere, and the plugins were tiny, did their job, and did it much more transparently. The main thing I had to do was transform their XML into GeoJSON on our webserver (their backend had only rudimentary GeoJSON support at the time - I think their internal teams either refused or were not allowed to update it?).

Anyway didn't mean to write a mini-blog post shilling Leaflet, it's a great library, my first experience of it was that it saved a seemingly doomed project, it does exactly what it says on the box and not much else, which is perfect when it's just a small component of a much larger and more complex project. It's my first go-to for interactive map rendering and even non-map stuff, like zoomable gigapixel photos.

Re: LeafletJS: a JavaScript library for interactive maps

#54
I’m working on a writing prep web app that will have an interactive map feature. How nice for this to show up on the hn front page, I assumed I’d be making something custom in threejs until now.

It’s called plotbinder - the app and it’s website (plotbinder.com, currently nothing is hosted) should go online sometime in September

Re: LeafletJS: a JavaScript library for interactive maps

#56

I've done a couple of projects for clients with google maps - what's the advantages/disadvantages of using this?

Google maps which descended from Google Earth provides a map of Earth as seen from a satellite.

Museums might want a control of their experience without having to collaborate with Google. Or, Fantastical maps for video game or nerdlore.

Re: LeafletJS: a JavaScript library for interactive maps

#57

Leaflet is fantastic. One of the more interesting use cases I've seen for it is the Guild Wars 2 wiki. They use it heavily to display the game map for regions, areas of interests etc. It's quite impressive, and very useful as a player! https://wiki.guildwars2.com/wiki/Kryta#Interactive_Map

This got me wondering if my favorite game as a kid, RuneScape, also uses Leaflet on their world map for Old School RuneScape (the version I am more familiar with). It turns out they do. Cool!

https://oldschool.tools/world-map

Re: LeafletJS: a JavaScript library for interactive maps

#58

I've done a couple of projects for clients with google maps - what's the advantages/disadvantages of using this?

Google Maps prices are now outrageous https://geoawesomeness.com/developers-up-in-arms-over-google...

Not to mention respecting the privacy of your users.

Re: LeafletJS: a JavaScript library for interactive maps

#59
post #25

I’ve used Leaflet a ton and love it. But I recently tried using it with a vector-based render method (as opposed to the rastered tiles Leaflet uses by default) and couldn’t find anything that worked anywhere near as easily and simply as Leaflet’s standard rendering. I don’t blame the Leaflet folks for this really, rendering map data locally via WebGL is not a simple task. But it’s been depressing to see folks like Ma…

I'm the original author of Leaflet and also (as of last 8 years) core developer of Mapbox GL JS. Not pursuing vector rendering in Leaflet is intentional — it's designed to be extremely small, simple and lightweight. Vector map rendering is so incredibly difficult to do right that it's pretty much impossible without many years of team effort by top engineers and millions in investment.

Re: LeafletJS: a JavaScript library for interactive maps

#60
I'm the original author of Leaflet, ask me anything! Very happy every time I see it shared on the HN frontpage.

If you're curious about the story behind Leaflet and how and why it was born 10 years ago, here's a short 13-minute presentation on this: https://youtu.be/NLbyHffKQuU

Post reply on HN