In this case I use Map
control from OpenLayers 2.10. On map I have base layer
which is OpenLayers.Layer.OSM
and OpenLayers.Layer.Vector
with custom features. Now when I move map using mouse the features that weren't previously visible won't redraw until release of mouse button. I have noticed the same issue in all OpenLayers
examples. Can anyone provide some kind of work around to change this behaviour? What I want to achieve is to draw features immediately after feature becomes visible or always draw all features (I work with small number of features so performance of map control isn't critical).
My current idea is to handle some specific events on map (like mouse move with click) and force features redraw.
The SVG2
renderer was introduced in v2.11, and then immediately deprecated in v2.12 for reliability reasons (See this pull request). For OL >= 2.12, set the layer's ratio
property to have it render all features within a wider area as a ratio of the screen size. The trade-off is performance, and if your user "throws" their map in some direction, they will fly past the features, but at that point they probably expect to have some rendering delays.
new OpenLayers.Layer.Vector("My Layer", {
ratio: 2
});
From http://lists.osgeo.org/pipermail/openlayers-dev/2011-March/007345.html :
the new
OpenLayers.Renderer.SVG2
renderer does what you are requesting. It is available on trunk (and will be in 2.11). To use it, configure the renderers array for yourOpenLayers.Layer.Vector
like this:new OpenLayers.Layer.Vector("My Layer", { renderers: ["SVG2", "VML", "Canvas"] });
Or set it on the prototype:
OpenLayers.Layer.Vector.renderers = ["SVG2", "VML", "Canvas"];
Note that VML (used in IE6,7,8) and Canvas (used on Android devices) behave like
Renderer.SVG
and don't draw features while panning.
With OpenLayer v6.4.3 you can set the following property of VectorLayer:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With