[OpenLayers-Users] Re: Automatic updation of OpenLayers code
Robert Sanson
Robert.Sanson at asurequality.com
Wed Jun 8 00:38:59 EDT 2011
You can use JavaScipt code to remove existing layers and add new ones, based on user interaction.
For example, if you had a function that called a URL that returned some JSON data, you could turn it into a new layer:
function othptsreturn(response) {
if (response.responseText.indexOf('missing') != -1) {
}
else {
var json_format = new OpenLayers.Format.JSON();
var oFeatures = json_format.read(response.responseText);
var othptsl = new OpenLayers.Layer.Vector("Other Points",
{isBaseLayer: false,
styleMap: othStyles,
extractAttributes: true });
othptsl.addFeatures(oFeatures);
map.addLayer(othptsl);
}
}
Regards,
Robert
>>> Vikash Talanki <vikashtalanki at gmail.com> 8/06/2011 4:27 p.m. >>>
Does this suffice adding of a new layer?? adding a point to existing layer is
trivial but adding a new layer itself need to put its specific code in JS.
Let me explain with an example, suppose my map already has 3 layers. Now if
the user wants to add 4th layer then I can provide him a form to fill the
data and store these 4th layers details/data in a text file/db through a php
script. Up to here everything is fine, but now someone has to add this layer
to JS so that the user can see it as soon as he reload the page.
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Automatic-updation-of-OpenLayers-code-tp6452157p6452308.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
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.
This message has been scanned for Malware and Viruses by Websense Hosted Security.
www.websense.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110608/c604a18a/attachment.html
More information about the Users
mailing list