<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px">
<DIV>I ended up using layer.destroy();, followed by recreating the layer from scratch, but aos had to add some dummy date to the end, to force the browser to load from the Web server, rather than from cache like so:</DIV>
<DIV> </DIV>
<DIV>dummyDate = new Date() ;<BR>dummyParameter = "&" + dummyDate.getTime();</DIV>
<DIV> </DIV>fbnd = new OpenLayers.Layer.GML("Farm boundary",<BR> "<A href='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</A>" + dummyParameter,<BR> {singleTile: true, style: farm_style, extractAttributes: true});<BR> map.addLayer(fbnd);
<DIV> </DIV>
<DIV>Robert<BR><BR>>>> Jesus <mogollonster@gmail.com> 19/09/2008 1:24 p.m. >>><BR><BR>Hi, i have the same problem i try the layer.redraw(true) method, cause it<BR>should reload the layer? but nothing<BR><BR>I notice that if i create a new layer or even a map it not instantiate a new<BR>object it just add the new members of the old one to the new one.<BR><BR>any clue?<BR><BR>I?m using the zoomify layers proposed in<BR><A href="http://oldmapsonline.googlecode.com/svn/trunk/openlayers/examples/zoomify.html">http://oldmapsonline.googlecode.com/svn/trunk/openlayers/examples/zoomify.html</A><BR><BR>but i need reload the images each minute, and i can't<BR><BR><BR>Robert Sanson wrote:<BR>> <BR>> Hi<BR>> <BR>> The trick to getting the reload layer to work was to add a dummy parameter<BR>> to the end of the URL, so the browser thought it was a new request.<BR>> <BR>> Cheers,<BR>> <BR>> Robert <BR>> <BR>>>>> "Robert Sanson" <SansonR@asurequality.com> 18/09/2008 12:03 p.m. >>><BR>> Does anyone know how to remove and reload a GML layer?<BR>> <BR>> I have a layer added to my map as:<BR>> <BR>> va map, fbnd;<BR>> <BR>> fbnd = new OpenLayers.Layer.GML("Farm boundary",<BR>> <BR>> "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<BR>> (<BR>> 'http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&amp;request=getfeature&amp;typename=farm&amp;service=wfs&amp;version=1.0.0&amp;BBOX="+x1+","+y1+","+x2+","+y2+"&amp;maxfeatures=120'<BR>> )",<BR>> {singleTile: true, style: farm_style, extractAttributes:<BR>> true});<BR>> map.addLayer(fbnd);<BR>> <BR>> I then do some edits to the database.<BR>> <BR>> I now want to remove it and reload it, based on a user clicking a button<BR>> <BR>> I tried:<BR>> <BR>> map.removeLayer(fbnd,false); <BR>> <BR>> This works, but then iI tried to reload it as:<BR>> <BR>> fbnd = new OpenLayers.Layer.GML("Farm boundary",<BR>> <BR>> "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<BR>> (<BR>> 'http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&amp;request=getfeature&amp;typename=farm&amp;service=wfs&amp;version=1.0.0&amp;BBOX="+x1+","+y1+","+x2+","+y2+"&amp;maxfeatures=120'<BR>> )",<BR>> {singleTile: true, style: farm_style, extractAttributes:<BR>> true});<BR>> map.addLayer(fbnd);<BR>> <BR>> This seems to load the same data without forcing a refresh.<BR>> <BR>> Any clues?<BR>> <BR>> Many thanks,<BR>> <BR>> Robert<BR>> <BR>> <BR>> <BR>> <BR>> ------------------------------------------------------------------<BR>> The contents of this email are confidential to AsureQuality. If you have<BR>> received this communication in error please notify the sender immediately<BR>> and delete the message and any attachments. The opinions expressed in this<BR>> email are not necessarily those of AsureQuality. This message has been<BR>> scanned for known viruses before delivery. AsureQuality supports the<BR>> Unsolicited Electronic Messages Act 2007. If you do not wish to receive<BR>> similar communications in future, please notify the sender of this<BR>> message.<BR>> ------------------------------------------------------------------<BR>> <BR>> <BR>> <BR>> This message has been scanned for malware by SurfControl plc.<BR>> www.surfcontrol.com ( <A href="http://www.surfcontrol.com/">http://www.surfcontrol.com/</A> )<BR>> <BR>> <BR>> Click here (<BR>> <A href="https://www.mailcontrol.com/sr/lboVqLLfumvTndxI!oX7UhblTb0BBCjq4am39x6ai4pLLlBB97uqOsrupOtDxR9eNzk2Jf8HBVsDNW0+5ADKWw==">https://www.mailcontrol.com/sr/lboVqLLfumvTndxI!oX7UhblTb0BBCjq4am39x6ai4pLLlBB97uqOsrupOtDxR9eNzk2Jf8HBVsDNW0+5ADKWw==</A><BR>> ) to report this email as spam.<BR>> ------------------------------------------------------------------<BR>> The contents of this email are confidential to AsureQuality. If you have<BR>> received this communication in error please notify the sender immediately<BR>> and delete the message and any attachments. The opinions expressed in this<BR>> email are not necessarily those of AsureQuality. This message has been<BR>> scanned for known viruses before delivery. AsureQuality supports the<BR>> Unsolicited Electronic Messages Act 2007. If you do not wish to receive<BR>> similar communications in future, please notify the sender of this<BR>> message.<BR>> ------------------------------------------------------------------<BR>> <BR>> _______________________________________________<BR>> Users mailing list<BR>> Users@openlayers.org<BR>> <A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR>> <BR>> <BR><BR>-- <BR>View this message in context: <A href="http://n2.nabble.com/How-to-remove-and-reload-a-GML-layer-tp1096944p1099858.html">http://n2.nabble.com/How-to-remove-and-reload-a-GML-layer-tp1096944p1099858.html</A><BR>Sent from the OpenLayers Users mailing list archive at Nabble.com.<BR><BR>_______________________________________________<BR>Users mailing list<BR>Users@openlayers.org<BR><A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR></DIV><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
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.<br>
------------------------------------------------------------------</td></tr></table></BODY></HTML>