[OpenLayers-Users] How to remove and reload a GML layer

Robert Sanson SansonR at asurequality.com
Wed Sep 17 20:03:29 EDT 2008


Does anyone know how to remove and reload a GML layer?
 
I have a layer added to my map as:
 
va map, fbnd;
 
fbnd = new OpenLayers.Layer.GML("Farm boundary",
                "http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&request=getfeature&typename=farm&service=wfs&version=1.0.0&BBOX="+x1+","+y1+","+x2+","+y2+"&maxfeatures=120 ( 'http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&request=getfeature&typename=farm&service=wfs&version=1.0.0&BBOX="+x1+","+y1+","+x2+","+y2+"&maxfeatures=120' )",
                {singleTile: true, style: farm_style, extractAttributes: true});
              map.addLayer(fbnd);
 
I then do some edits to the database.
 
I now want to remove it and reload it, based on a user clicking a button
 
I tried:
 
map.removeLayer(fbnd,false);
 
This works, but then iI tried to reload it as:
 
fbnd = new OpenLayers.Layer.GML("Farm boundary",
                "http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&request=getfeature&typename=farm&service=wfs&version=1.0.0&BBOX="+x1+","+y1+","+x2+","+y2+"&maxfeatures=120 ( 'http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&request=getfeature&typename=farm&service=wfs&version=1.0.0&BBOX="+x1+","+y1+","+x2+","+y2+"&maxfeatures=120' )",
                {singleTile: true, style: farm_style, extractAttributes: true});
              map.addLayer(fbnd);
 
This seems to load the same data without forcing a refresh.
 
Any clues?
 
Many thanks,
 
Robert
------------------------------------------------------------------
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.
------------------------------------------------------------------


This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080918/b14f8db5/attachment.html


More information about the Users mailing list