[OpenLayers-Users] OpenLayers.Layers.Text with variable filename as input

Robert Sanson SansonR at asurequality.com
Mon May 19 16:38:40 EDT 2008


Hi Carl
 
Indeed it is possible. I do the same with my application. See code snippet below:
 
if(gTF==1){ 
                    var gate = new OpenLayers.Layer.Text( "Gate", {location: "./farmfiles/" + farmid + ".gate"} );
                    map.addLayer(gate);
}
 
In this case, I use a variable called farmid, and the text file is composed of this plus some other bits.
 
Kind regards,
 
Robert Sanson

>>> Carl Morgan <carl.r.morgan at noaa.gov> 19/05/2008 11:25 p.m. >>>

Hello,

I am very new to OpenLayers and just as new to javascript, so I 
apologize in advance for my lack of basic understanding of all of this.

But, I am attempting to plot points on a map using 
OpenLayers.Layers.Text and it works just fine. However I would ideally 
like to pass the filename in through the URL. In the following line, I 
would like to replace "./lsrtext.txt" with a variable but am having no 
luck.

var newl = new OpenLayers.Layer.Text( "text", {location: "./lsrtext.txt"} );

Is it possible to do such a thing? I have the code working which 
processes the variable name, and I am able to process the lat, lon and 
zoom level this way. But I can't seem to get it working with the 
filename. The documentation states that the URL of the text file can't 
be changed once passed in. Does this count as changing?

Thanks for any help!

-Carl
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



------------------------------------------------------------------
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/20080520/9b86dde7/attachment.html


More information about the Users mailing list