1

In a leaflet application, I have a base map, and several overlay layers, each of which are showing GeoJSON. The GeoJSON is going update (client receives over a websocket) at 4Hz.

The GeoJSON consists of a good number of polylines. The area covered is pretty small, so I don't think that tiling the GeoJSON will help.

I don't think that their will be so much data that it will overwhelm the browser/client. But I want to know if anyone has tips on what could decrease the load on the browser.

I.e. I could should to delete the layer content each update and load fresh content.

Or I could as the server to give me vertex list for the new layout of the polylines and then do an update in the browser.

There are probably other ways to minimize work. (e.g. are there plugins for this problem?) nothing in the leaflet plugin list leaped out at me.

What tips do you have?

2

Personally I would pragmatically approach the questions you have. Is it worth the development time & effort (client- and serverside) to constantly diff the GeoJSON and only send/add the new parts? As you stated in your question that there won't be a lot of data to process or max out the browser memory, I probably would go for deleting the 'old' layer and load the fresh content. But of course that advice is merely based on what you describe in your question, so perhaps there are other factors which would exclude certain approaches.

Secondly, I would indeed look for existing Leaflet plugins to make a flying start. I took a look at the Leaflet plugin list, Dynamic & custom data loading section, and the Leaflet Realtime plugin seems to be a good fit for your use case.

  • good advice. Actually, of the two plugins that I looked at: leafletjs.com/plugins.html#time--elevation , the timeline looks likes like a cleaner and clearer implementation of GeoJSON. thant the TimeDimension (very impressive, but complex and I can't see why it has to be that way). – Dr.YSG Nov 23 '15 at 17:24
  • Good to hear. If you found my answer helpful, please consider upvoting and/or accepting it. And that is an interesting thought to also look at plugins for time-space visualization. I will check it out. – Sidney Gijzen Nov 25 '15 at 8:34

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.