Maybe I am doing this wrong but I cannot seem to remove a vector layer that
is added to the map with the following code. I tried to debug and it seems
features[] is an empty array so I'm not sure if removeAllFeatures will
work.. and when I just say map.removeLayer[grid] it does not work and I get
the this.layer.map is null. I tried to remove this layer outside of this
function also but I get a different error - isFixed is null/not an object.
Appreciate any assistance on how to remove this vector layer.. and also is
it possible to add more results to this grid layer each time instead of
recreating it so I can have multiple red boxes showing on the results?
Thanks.
var grid = new OpenLayers.Layer.Vector(name, {
displayInLayerSwitcher: true,
// init style
styleMap: new OpenLayers.StyleMap(style),
// init strategy : fixed=WFS query once, Cluster=Point feature group
within a tolerance
// speeding up drawing process
strategies: [new OpenLayers.Strategy.Fixed()],
// WFS 1.0.0 (for GeoMedia WebMap 6.0)
protocol: new OpenLayers.Protocol.WFS({
url: wfs,
featureType: "WEB_Parcels",
featureNS: "http://www.intergraph.com/geomedia/gml",
featurePrefix: "gmgml",
srsName: "EPSG:3776",
filter: filter,
geometryName: "Geometry",
version: "1.1.0"
})
});
map.addLayer(grid);
//recenter on selection
grid.events.register("loadend", grid, function() {
map.zoomToExtent(grid.getDataExtent());
map.zoomOut();
});
map.removeLayer(grid);
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Cannot-remove-vector-layer-from-map-this-layer-is-null-tp5936006p5936006.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users