I've a scenario that I need to display many lines on the map (for instance all road links of Manchester in UK). I am using Leaflet as map plugin. I use geoJSON as source of data, when I try to load more than 1000 features the map and browser become unresponsive.
What do you propose to improve performance when number of features to be drawn is larger than 1000 (even more..)?

I was thinking of a way to just display only roads which are in the shown map extent. But still if user zooms out number of features will be exceeded.

  • 1
    One common solution to this kind of problem is to render the tiles on the server as a WMS layer. Obvioust if you need to actually interact with the features, you will need to fetch this you need as GeoJSON, but you haven't stated if interaction is a requirement. – John Powell Apr 12 '15 at 10:35
  • @JohnBarça That's good idea. So I need to generate tiles with for all zoom levels then? but the thing is I am using online WMS layer. – Shahin Apr 12 '15 at 11:55

For questions like these, I find Tom MacWright's Mapmakers Cheat Sheet useful.

In your particular case, look at the section about lines: https://github.com/tmcw/mapmakers-cheatsheet#lines.

As already mentioned by @john-barça, a tiling solution is probably best; I'm personally not a fan of WMS though, I usually find mbtiles etc easier to work with.

  • Thank you. Actually since my system needs to be dynamic, I am not supposed to use tile generation. I've done a test in giscloud.com to display 25000 lines and it showed lines very quickly but I am not sure if they are using Leaflet. Still looking for a way to do it with online mapping and without tile generation. – Shahin Apr 13 '15 at 9:50
  • @Liedman agreed on wms and thanks for idea of using mbtiles. Hadn't heard of that. – John Powell Apr 13 '15 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.