I need to clear an in-memory overlay in clientside (javascript).
I already know “How to clear these types of overlays in serverside”
and also, there is a map.clearEditingFeatures();
for EditingOvaerlay.
But what about other In-Memory overlays? Is there any way to clear/remove all features in them in javascript?
How to clear an in-memory overlay in clientside
Hi Reza,
If that’s a custom overlay, you can find it and clear that by OpenLayers API(http://dev.openlayers.org/releases/OpenLayers-2.13.1/doc/apidocs/files/OpenLayers-js.html).
It should work like this: Map1.GetOpenLayersMap().getLayersByName("")
Regards,
Don
Map1.getOpenLayers.getLayersByName("")
And Map1.getOpenLayersMap().getLayersByName("InvalidOverlay")
just returns layer.
please exactly point out: whitch method (or property or what ever) should i call inorder to clear specific in-memory layer at client-side.
NOTE: By “Clear”, I mean remove all features in the layer or at least invisible all shapes in it.
Hi Reza,
The layer on client side means the overlay on server side, so if you want to do any operation to the layer on client side, just get it by JavaScript code then call OpenLayers API or JavaScript API to it. Our Client side API only support some special function.
For you requirement, I think you can directly hide the layer on client side if set invisible all shapes in it is acceptable.
Please view this topic, I think the code is helpful here:
And please don’t forget call Redraw(‘true’) to force it refresh.
Regards,
Don