Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A few reasons:

1) Some of the most popular map library frontends like Leaflet support only raster tile layers out of the box.

2) Quality vector generalization (feature-dropping) is much more difficult than raster generalization.

3) A large fraction of use cases just need a "good enough" basemap without those extra features.



Seems like MapTiler is maintaining an open source full stack vector alternative, and OpenLayers[0] looks good as well, so maybe it's time for legacy libraries to add vector support, or for users to switch libraries? There's even bindings from Maplibre GL to Leaflet [1].

I at least would find it interesting to see the two compared by someone other than me ;).

[0] https://openlayers.org/

[1] https://github.com/maplibre/maplibre-gl-leaflet


Well, I wrote one already for leaflet ;)

https://github.com/protomaps/protomaps.js

TBH, the blocker is not demand for vector rendering but the technical difficulty and performance constraints of doing rasterization in the browser.


Nice! Only on Hacker news can you make a comment about some kind of hypothetical programming project and have the reply be "Yes, I've made one of those already".

Do you think it's still too early to switch to vector map data for all clients then? Maybe render raster tiles on demand on the server to those clients that can't handle it?


The barriers to adopting vector-everywhere are social and commercial, not technical.

There are a couple great public raster services like osm.org's default style and http://maps.stamen.com. These are 100% free to use, so they get used everywhere, but incur significant expense to the organizations running (paying) for them.

There aren't equivalent solutions in vector-land yet... I wrote a bit about this previously: https://protomaps.com/blog/free-tier-maps


https://maps.qwant.com uses vector tiles, altough polygon simplification at lower zoom levels could be improved.

Their stack is open sorce, described there: https://github.com/Qwant/qwantmaps#tile-server


Thanks for this. I remember using MVTs on HTML Canvas with Leaflet via plugin way back in 2017.[1] It wasn't perfect, but browser rendering has definitely been the bigger issue than anything with Leaflet.

[1]: https://github.com/SpatialServer/Leaflet.MapboxVectorTile


Can't you just convert the data to SVG and let the browser display that?


SVG will become sluggish past a few thousand features, which is typical for viewing an urban area on the map.


>> SVG will become sluggish past a few thousand features, which is typical for viewing an urban area on the map.

So lets optimize the browsers SVG rendering?


I'm surprised I don't see more implementations caching and serving vector tiles. I know some (most?) large mapping companies do this.

I maintain a heavily used map of the US, and I found that storing data/serving in vector format seems to be the most efficient (on AWS s3 / DO spaces), and converting to raster in the browser or with a service call / lambda really opens the doors to a lot more use cases. I suspect parent can talk more about this than I can.


vector tiles are years-old now.. there are a dozen decent implementations.. why would Leaflet not support vector tiles ? is there some commercial agreement behind closed doors regarding crippled Leaflet now?


Because Leaflet is an extensible library for building map UIs using the browser, using DOM elements as grid cells, and using SVG in some cases for overlay geometry and user interaction.

Things that are mandatory for map display, like:

- Label priority and positioning

- Display of internationalized, RTL, and Bidi text

- Geometry rasterization and styling

Are outside the scope of Leaflet's core design and can be implemented by plugins, one of which I have linked in a sibling comment.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: