<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>&nbsp;</DIV>
<DIV>dummyDate = new Date() ;<BR>dummyParameter = "&amp;" + dummyDate.getTime();</DIV>
<DIV>&nbsp;</DIV>fbnd = new OpenLayers.Layer.GML("Farm boundary",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;"<A href='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'>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</A>" + dummyParameter,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{singleTile: true, style: farm_style, extractAttributes: true});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayer(fbnd);
<DIV>&nbsp;</DIV>
<DIV>Robert<BR><BR>&gt;&gt;&gt; Jesus &lt;mogollonster@gmail.com&gt; 19/09/2008 1:24 p.m. &gt;&gt;&gt;<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>&gt; <BR>&gt; Hi<BR>&gt;&nbsp; <BR>&gt; The trick to getting the reload layer to work was to add a dummy parameter<BR>&gt; to the end of the URL, so the browser thought it was a new request.<BR>&gt;&nbsp; <BR>&gt; Cheers,<BR>&gt;&nbsp; <BR>&gt; Robert <BR>&gt; <BR>&gt;&gt;&gt;&gt; "Robert Sanson" &lt;SansonR@asurequality.com&gt; 18/09/2008 12:03 p.m. &gt;&gt;&gt;<BR>&gt; Does anyone know how to remove and reload a GML layer?<BR>&gt;&nbsp; <BR>&gt; I have a layer added to my map as:<BR>&gt;&nbsp; <BR>&gt; va map, fbnd;<BR>&gt;&nbsp; <BR>&gt; fbnd = new OpenLayers.Layer.GML("Farm boundary",<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&gt; "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>&gt; (<BR>&gt; 'http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&amp;amp;request=getfeature&amp;amp;typename=farm&amp;amp;service=wfs&amp;amp;version=1.0.0&amp;amp;BBOX="+x1+","+y1+","+x2+","+y2+"&amp;amp;maxfeatures=120'<BR>&gt; )",<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {singleTile: true, style: farm_style, extractAttributes:<BR>&gt; true});<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayer(fbnd);<BR>&gt;&nbsp; <BR>&gt; I then do some edits to the database.<BR>&gt;&nbsp; <BR>&gt; I now want to remove it and reload it, based on a user clicking a button<BR>&gt;&nbsp; <BR>&gt; I tried:<BR>&gt;&nbsp; <BR>&gt; map.removeLayer(fbnd,false); <BR>&gt;&nbsp; <BR>&gt; This works, but then iI tried to reload it as:<BR>&gt;&nbsp; <BR>&gt; fbnd = new OpenLayers.Layer.GML("Farm boundary",<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&gt; "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>&gt; (<BR>&gt; 'http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid+"&amp;amp;request=getfeature&amp;amp;typename=farm&amp;amp;service=wfs&amp;amp;version=1.0.0&amp;amp;BBOX="+x1+","+y1+","+x2+","+y2+"&amp;amp;maxfeatures=120'<BR>&gt; )",<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {singleTile: true, style: farm_style, extractAttributes:<BR>&gt; true});<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayer(fbnd);<BR>&gt;&nbsp; <BR>&gt; This seems to load the same data without forcing a refresh.<BR>&gt;&nbsp; <BR>&gt; Any clues?<BR>&gt;&nbsp; <BR>&gt; Many thanks,<BR>&gt;&nbsp; <BR>&gt; Robert<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; ------------------------------------------------------------------<BR>&gt; The contents of this email are confidential to AsureQuality. If you have<BR>&gt; received this communication in error please notify the sender immediately<BR>&gt; and delete the message and any attachments. The opinions expressed in this<BR>&gt; email are not necessarily those of AsureQuality. This message has been<BR>&gt; scanned for known viruses before delivery. AsureQuality supports the<BR>&gt; Unsolicited Electronic Messages Act 2007. If you do not wish to receive<BR>&gt; similar communications in future, please notify the sender of this<BR>&gt; message.<BR>&gt; ------------------------------------------------------------------<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; This message has been scanned for malware by SurfControl plc.<BR>&gt; www.surfcontrol.com ( <A href="http://www.surfcontrol.com/">http://www.surfcontrol.com/</A> )<BR>&gt; <BR>&gt; <BR>&gt; Click here (<BR>&gt; <A href="https://www.mailcontrol.com/sr/lboVqLLfumvTndxI!oX7UhblTb0BBCjq4am39x6ai4pLLlBB97uqOsrupOtDxR9eNzk2Jf8HBVsDNW0+5ADKWw==">https://www.mailcontrol.com/sr/lboVqLLfumvTndxI!oX7UhblTb0BBCjq4am39x6ai4pLLlBB97uqOsrupOtDxR9eNzk2Jf8HBVsDNW0+5ADKWw==</A><BR>&gt; ) to report this email as spam.<BR>&gt; ------------------------------------------------------------------<BR>&gt; The contents of this email are confidential to AsureQuality. If you have<BR>&gt; received this communication in error please notify the sender immediately<BR>&gt; and delete the message and any attachments. The opinions expressed in this<BR>&gt; email are not necessarily those of AsureQuality. This message has been<BR>&gt; scanned for known viruses before delivery. AsureQuality supports the<BR>&gt; Unsolicited Electronic Messages Act 2007. If you do not wish to receive<BR>&gt; similar communications in future, please notify the sender of this<BR>&gt; message.<BR>&gt; ------------------------------------------------------------------<BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; Users mailing list<BR>&gt; Users@openlayers.org<BR>&gt; <A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR>&gt; <BR>&gt; <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&nbsp;contents&nbsp;of&nbsp;this&nbsp;email&nbsp;are&nbsp;confidential&nbsp;to&nbsp;AsureQuality.&nbsp;If&nbsp;you&nbsp;have&nbsp;received&nbsp;this&nbsp;communication&nbsp;in&nbsp;error&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;delete&nbsp;the&nbsp;message&nbsp;and&nbsp;any&nbsp;attachments.&nbsp;The&nbsp;opinions&nbsp;expressed&nbsp;in&nbsp;this&nbsp;email&nbsp;are&nbsp;not&nbsp;necessarily&nbsp;those&nbsp;of&nbsp;AsureQuality.&nbsp;This&nbsp;message&nbsp;has&nbsp;been&nbsp;scanned&nbsp;for&nbsp;known&nbsp;viruses&nbsp;before&nbsp;delivery.&nbsp;AsureQuality&nbsp;supports&nbsp;the&nbsp;Unsolicited&nbsp;Electronic&nbsp;Messages&nbsp;Act&nbsp;2007.&nbsp;If&nbsp;you&nbsp;do&nbsp;not&nbsp;wish&nbsp;to&nbsp;receive&nbsp;similar&nbsp;communications&nbsp;in&nbsp;future,&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;of&nbsp;this&nbsp;message.<br>
------------------------------------------------------------------</td></tr></table></BODY></HTML>