[OpenLayers-Users] general advice on speeding up vector rendering
Mr. Puneet Kishor
punk.kish at gmail.com
Mon Sep 26 00:21:24 EDT 2011
Andreas Hocevar had the following advice
> 3000 vector features take a while to parse, and during that time image
> rendering will be very slow. If you want to make sure that your map tiles
> are rendered before the vector features are parsed, you should listen to the
> loadend events of your tile layers and load the vector layer afterwards.
>
> You may also want to have a look at http://ol-performance.appspot.com/ for
> performance tuning tips.
Based on the above, I have the following general questions. But, first, my scenario -- I am drawing sensor readings from ~3000 stations around the world. I have optimized data selection (from Pg) and data transfer (via compact JSON and use of a keymap for the long key names). The data arrive at the browser really quick, but then, the browser waits and thinks.... just as Andreas wrote above. Then suddenly, boom, all the points are plopped on the map. Once there are so many points on the map, the map is really sluggish to pan and zoom. The popups take forever to build, and other layers also become leaden in their performance.
Here is what I could do, with the pros and cons. I would love the insight of you veterans --
1. I could employ some kind of a BBOX strategy. However, the sensors are not distributed evenly around the world. There are a whole lot of them in North America, and more sparse in the rest of the world.
2. I could have some zoom level threshold below which MapServer would generate WMS, and only above the threshold would the layer flip to being a vector layer. However, once again, one could be zoomed in on North America and still have a boat load of features to deal with.
3. For any given view, I could some how try to figure out how many features would be retrieved, and flip/flop between WMS and vector based on that. On the other hand, how I would implement that, I have no idea.
4. An additional issue is scaling the features -- to scale them to a correct size (based on an attribute), I need to know the min and max of that attribute. This is doable when retrieving the features as JSON, but becomes problematic when creating WMS via map files.
I would love to hear all suggestions.
Puneet.
More information about the Users
mailing list