LeafletJS: a JavaScript library for interactive maps
mekkkkkk 2021-08-16 22:40:20 +0000 UTC [ - ]
phsource 2021-08-17 06:42:41 +0000 UTC [ - ]
My brother and I created a map of our local Costco in Figma and just put it up at https://costcomap.com/
varrock 2021-08-17 05:39:00 +0000 UTC [ - ]
dante_dev 2021-08-17 10:52:16 +0000 UTC [ - ]
Cyberdog 2021-08-17 02:18:59 +0000 UTC [ - ]
vmarsy 2021-08-16 22:25:36 +0000 UTC [ - ]
avel 2021-08-16 22:36:51 +0000 UTC [ - ]
panopticon 2021-08-16 22:53:04 +0000 UTC [ - ]
zamadatix 2021-08-17 13:50:01 +0000 UTC [ - ]
katabasis 2021-08-16 23:44:24 +0000 UTC [ - ]
ddoolin 2021-08-17 00:10:31 +0000 UTC [ - ]
parksy 2021-08-17 03:36:49 +0000 UTC [ - ]
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.
afavour 2021-08-16 23:22:31 +0000 UTC [ - ]
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 MapBox close off their vector-based library (and Google’s isn’t open either). There’s an open source of Mapbox’s library but it still feels like the open source world is being left out in the cold compared to how things were just a few years ago.
mourner 2021-08-17 06:30:30 +0000 UTC [ - ]
appleflaxen 2021-08-17 10:08:32 +0000 UTC [ - ]
mourner 2021-08-17 11:51:38 +0000 UTC [ - ]
Rendering vector data on the browser with the level of detalization necessary for modern cartography (hundreds of thousands of points in a single view) is not possible with the usual technologies like Canvas & SVG. The only option is WebGL, which is basically a very efficient way to draw triangles. You have to implement all the logic of turning all the data into triangles (tessellating lines, breaking down polygons, implementing anti-aliasing, figuring out collision detection between labels) from scratch, reimplementing difficult computer graphics algorithms from decades ago. This is a MASSIVE amount of work, and hard to do in a performant way.
Moreover, client-side vector rendering has even more complexity than server-side technologies like Mapnik, because you can't just render something once — you have to do it in real time, 60 frames per second, considering context, making fluid animations when zooming, panning and loading data, etc.
You can learn more details about this in my presentation on vector maps e.g. here: https://youtu.be/v-V8SS14R48
NelsonMinar 2021-08-17 00:46:11 +0000 UTC [ - ]
MapLibre.org gives me hope. It's a fork of the MapBox GL JS code that intends to be fully open source and independent.
Another option for open source vector mapping was Mapzen's Tangram. Mapzen shut down, what, two years ago? But they open source released everything. I'm not sure if Tangram has a life of its own.
bdon 2021-08-17 00:01:34 +0000 UTC [ - ]
http://github.com/protomaps/protomaps.js
so it would be valuable to know if it can get closer to what you wanted to accomplish.
barnabask 2021-08-16 23:55:26 +0000 UTC [ - ]
bebop 2021-08-16 23:43:03 +0000 UTC [ - ]
hamburgerwah 2021-08-16 22:03:03 +0000 UTC [ - ]
tshaddox 2021-08-16 22:41:19 +0000 UTC [ - ]
I've also used Mapbox which provides a much fancier OpenGL map with fancy things like continuous (smooth) zoom levels. Mapbox feels a lot more like a modern Google Maps-esque mapping widget. https://docs.mapbox.com/mapbox-gl-js/example/
SahAssar 2021-08-16 23:10:04 +0000 UTC [ - ]
gkhartman 2021-08-16 22:20:05 +0000 UTC [ - ]
hajile 2021-08-16 22:16:41 +0000 UTC [ - ]
Cyberdog 2021-08-17 02:22:37 +0000 UTC [ - ]
hajile 2021-08-17 02:58:41 +0000 UTC [ - ]
SilverRed 2021-08-16 22:34:11 +0000 UTC [ - ]
smelendez 2021-08-16 23:31:31 +0000 UTC [ - ]
SilverRed 2021-08-16 23:36:10 +0000 UTC [ - ]
Cyberdog 2021-08-17 02:28:53 +0000 UTC [ - ]
I mean, I guess? Can't it be presumed that if you have a web site upon which you wish to place a map, you've already got a web server set up one way or another?
> Which usually means generating the tiles from scratch rather than relying on some precached ones.
Well, yes. The way I've set it up for my client is basically that we start from a large image which will be the map at its maximum "zoom in level" and run a script which scales the map 50% smaller, dices the image into 256x256 tiles, and saves those tiles with a pre-defined naming scheme (something like Xcoord_Ycoord_Zoomlevel.png - I can't recall the details), then scales the original map by 25%, creates tiles from that, and repeats until the entire map can fit into four tiles (512x512). It's not terribly difficult stuff for a reasonably capable developer to do, though working with the larger maps can eat up a lot of RAM on the system we run this script on.
aendruk 2021-08-17 02:18:51 +0000 UTC [ - ]
vgeek 2021-08-17 15:07:55 +0000 UTC [ - ]
http://maps.stamen.com/#toner/12/37.7706/-122.3782 - they have free tile servers (obviously, donate if you use them) that are relatively styled. They don't get updated and may not be 100%, but for small scale uses, they are good enough versus risking going over the free tiers at Mapbox or getting stuck in the Google ecosystem.
hdersch 2021-08-17 09:34:43 +0000 UTC [ - ]
the_third_wave 2021-08-16 22:14:20 +0000 UTC [ - ]
[1] https://git.libreoffice.org/online/+/master/loleaflet/README
c-smile 2021-08-16 22:56:31 +0000 UTC [ - ]
So it can be used in pretty much any native desktop application. Including desktop games that use DX11, DX12, Vulkan or Metal graphics.
theoa 2021-08-17 07:56:09 +0000 UTC [ - ]
The above is a list of awesome open source projects Vladimir Agafonkin is involved in.
Vlad's "Earcut" triangulator - embedded in Three.js - and his solar calculator are efforts that have helped me a lot.
I am wondering: have Vlad and Ricardo Cabello AKA "Mr.doob" ever hacked some linear algebra together??
dang 2021-08-16 22:16:43 +0000 UTC [ - ]
How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data - https://news.ycombinator.com/item?id=19784355 - April 2019 (20 comments)
Leaflet – A JavaScript library for mobile-friendly interactive maps - https://news.ycombinator.com/item?id=16149725 - Jan 2018 (36 comments)
Leaflet: An open-source JavaScript library for mobile-friendly interactive maps - https://news.ycombinator.com/item?id=13095390 - Dec 2016 (71 comments)
Leaflet 1.0 – A JavaScript library for mobile-friendly interactive maps - https://news.ycombinator.com/item?id=12589447 - Sept 2016 (99 comments)
D3 and Leaflet maps (2012) - https://news.ycombinator.com/item?id=11017763 - Feb 2016 (8 comments)
Show HN: Lens Battle – Make comparing lenses easier (with leaflet.js) - https://news.ycombinator.com/item?id=10279358 - Sept 2015 (11 comments)
Show HN: Quizzity – a geographical quiz built on top of a Leaflet map - https://news.ycombinator.com/item?id=8981162 - Feb 2015 (6 comments)
Show HN: Traverse City Platmap with Leaflet and D3 - https://news.ycombinator.com/item?id=8164315 - Aug 2014 (6 comments)
Testing web map APIs – Google vs OpenLayers vs Leaflet - https://news.ycombinator.com/item?id=7451375 - March 2014 (12 comments)
Show HN: Earthquakes on Leaflet, Crossfilter and D3 - https://news.ycombinator.com/item?id=5157054 - Feb 2013 (7 comments)
Leaftlet - A Lightweight JavaScript Library for Interactive Maps - https://news.ycombinator.com/item?id=2746178 - July 2011 (21 comments)
alyssaxuu 2021-08-17 08:54:06 +0000 UTC [ - ]
beezischillin 2021-08-16 22:13:10 +0000 UTC [ - ]
Other than that this is an awesome library with tons of great plugins that I’ve used for years now.
mourner 2021-08-17 06:42:28 +0000 UTC [ - ]
everybodyknows 2021-08-17 02:53:14 +0000 UTC [ - ]
1. Rotation not supported.
2. Debug source (leaflet-src.is) reports stale number: “1.6.0” for 1.7.1
chx 2021-08-16 22:39:46 +0000 UTC [ - ]
jokoon 2021-08-17 10:44:22 +0000 UTC [ - ]
My only wish is that I want to generate my own raster tiles, but I've seen that planet.osm now is 1.4TB, although the .PBF is only about 60GB.
I wish I could generate tiles of areas I want, but it seems the software requirements are pretty big, I'd rather use spatialite than postGIS, and I have no idea how to generate those tiles. There are a lot of GIS softwares, and most of them are pretty heavy, not to mention there are a lot of different formats which bloats everything.
pugets 2021-08-17 00:07:35 +0000 UTC [ - ]
bdon 2021-08-17 00:14:37 +0000 UTC [ - ]
Though you miss out on the wide range of Leaflet plugins!
shireboy 2021-08-17 02:21:56 +0000 UTC [ - ]
braden_lk 2021-08-16 23:49:12 +0000 UTC [ - ]
ls65536 2021-08-16 23:01:05 +0000 UTC [ - ]
cormacrelf 2021-08-17 09:37:38 +0000 UTC [ - ]
mattrighetti 2021-08-17 00:12:39 +0000 UTC [ - ]
garminpartenkir 2021-08-17 09:32:24 +0000 UTC [ - ]
benatkin 2021-08-16 23:18:01 +0000 UTC [ - ]
bdon 2021-08-17 00:09:03 +0000 UTC [ - ]
* MapLibre GL JS is a BSD licensed fork of Mapbox GL JS version 1. Instead of consuming bitmap image tiles, it consumes tiles corresponding to the same coordinate extents as the above tiles, but containing tagged geometry features. So instead of sending a PNG image you're sending what is essentially an SVG, but in binary format and with some domain-specific compression.
* The GL JS renderers also rasterize those vector tiles using WebGL, which means that all the geometry data exists in GPU memory and can be scaled, rotated, and recolored etc in realtime efficiently, and also implement their own limited text rendering so even labels can be rotated in realtime.
Waterluvian 2021-08-17 00:58:34 +0000 UTC [ - ]
Rd6n6 2021-08-17 03:47:17 +0000 UTC [ - ]
It’s called plotbinder - the app and it’s website (plotbinder.com, currently nothing is hosted) should go online sometime in September
nobunagato 2021-08-17 07:51:22 +0000 UTC [ - ]
jfjjfjfjfjfjfjf 2021-08-17 10:05:07 +0000 UTC [ - ]
cdrx 2021-08-17 09:08:24 +0000 UTC [ - ]
There are commercial products in this space too (like Maptiler).
gavreh 2021-08-17 13:01:00 +0000 UTC [ - ]
amcaskill 2021-08-16 22:40:24 +0000 UTC [ - ]
gennarro 2021-08-16 22:30:27 +0000 UTC [ - ]
lpasselin 2021-08-17 01:41:38 +0000 UTC [ - ]
math0ne 2021-08-17 02:19:40 +0000 UTC [ - ]
ve55 2021-08-16 23:00:28 +0000 UTC [ - ]
LAC-Tech 2021-08-17 04:41:00 +0000 UTC [ - ]
DanAtC 2021-08-17 06:14:00 +0000 UTC [ - ]
Not to mention respecting the privacy of your users.
alephnan 2021-08-17 04:49:56 +0000 UTC [ - ]
Museums might want a control of their experience without having to collaborate with Google. Or, Fantastical maps for video game or nerdlore.
antoniuschan99 2021-08-16 23:36:42 +0000 UTC [ - ]
Cool to see leaflet mentioned as I’ve been using it this week :P
ChrisMarshallNY 2021-08-17 01:11:14 +0000 UTC [ - ]
It’s an excellent library.
mourner 2021-08-17 06:35:43 +0000 UTC [ - ]
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
teddmagwell 2021-08-17 09:45:18 +0000 UTC [ - ]
Can you please share your thoughts on advantages and disadvantages of using WebGL vs just "<img>" elements (like on Leaflet homepage) to render tiled photos that require deep zoom.
I checked how some photo zoom solutions are made. For example, Google Photos uses tiled img elements, while online photo viewer in Apple iCloud used webgl to render. And I'm not sure what's best and why.
mourner 2021-08-17 14:31:46 +0000 UTC [ - ]
6jQhWNYh 2021-08-17 07:46:18 +0000 UTC [ - ]
Is there any plan to add on-the-fly reprojection within Leaflet core? Is it even the core's job to deal with projection or should this be done by plugins?
mourner 2021-08-17 08:01:26 +0000 UTC [ - ]
6jQhWNYh 2021-08-17 12:56:02 +0000 UTC [ - ]
andion 2021-08-17 07:15:49 +0000 UTC [ - ]
I always use leaflet when I have to work with maps, and I couldn't be more happy.
mourner 2021-08-17 15:22:13 +0000 UTC [ - ]
null4bl3 2021-08-17 19:40:00 +0000 UTC [ - ]
mourner 2021-08-18 09:51:40 +0000 UTC [ - ]
pipy 2021-08-17 16:10:50 +0000 UTC [ - ]
Thanks in advance
mourner 2021-08-18 09:54:12 +0000 UTC [ - ]