<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>You can write a function to refresh the layer. Something like:</DIV>
<DIV>&nbsp;</DIV>
<DIV>function refreshLayer() {</DIV>for (key in map.layers) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var layerRef = map.layers[key];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (layerRef.name == "Points"){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layerRef.destroy();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<DIV>//then your code for reloading the layer here, including re-adding to the map<BR>map.addLayer(myPoints);</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert<BR>&gt;&gt;&gt; Vikash Talanki &lt;vikashtalanki@gmail.com&gt; 8/06/2011 2:18 p.m. &gt;&gt;&gt;<BR>Hi, <BR><BR>&nbsp; I have my map code in openlayers JS. My input data is in a text file and I<BR>am able to render the points on the map. I have to give the user a right to<BR>create a layer by entering the data in a form. Writing a program to insert<BR>data into a text file is trivial. But I am stuck at how to include this<BR>layers code in the JS programmatically so that after giving the layers<BR>details in the form if the user reloads the page then the new layer should<BR>be visible, Any solutions??<BR><BR>--<BR>View this message in context: <A href="http://osgeo">http://osgeo</A>-org.1803224.n2.nabble.com/Automatic-updation-of-OpenLayers-code-tp6452157p6452157.html<BR>Sent from the OpenLayers Users mailing list archive at Nabble.com.<BR>_______________________________________________<BR>Users mailing list<BR>Users@lists.osgeo.org<BR><A href="http://lists.osgeo.org/mailman/listinfo/openlayers">http://lists.osgeo.org/mailman/listinfo/openlayers</A>-users<BR></DIV><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.</FONT></P>

<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for Malware and Viruses by Websense Hosted Security.  </FONT><A href="http://www.websense.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.websense.com</FONT></A></P>
</body></HTML>