4

I have 2 overlays with local tiles (xyz) on my map. When the user zoom in / out and pan the map intentionally a lot, the app becomes very slow because OL tries to render all the tiles it was requested by the pan & zoom, but they are no longer needed on the view because the user zoomed out from there.

Is there a way to reduce this load? Will it be faster if instead of xyz layer I'll use geojson layer with styles?

1 Answer 1

2
+100

You would have to be a on a fairly low-tech machine, or be zooming/panning via automation in order to have issues rendering only two XYZ layers. I suspect your issue is related to something else. If it was an actual issue, you could employ a bounds/extent trigger to stop rendering and halt network traffic for tiles that are out of view. That being said, OpenLayers does do this in the background for you.

Try creating a new OL3 map with just your two XYZ layers and see if you have the same issue. You can then use a browser profiler or network proxy (like Fiddler) to see where the performance issue might be.

Further to your question on GeoJSON v XYZ, if you decided to render GeoJSON, you're asking the browser engine to do a whole lot more than simply display an XYZ tile. Unless your data is very simple, then you're not going to get a performance boost from rendering the data yourself.

1
  • 2
    This answer doesnt hold true at this date, OpenLayers sends a lot of requests even while zooming and panning , such a mature library but still this functionality is so hard to hit. Commented Apr 12, 2022 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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