Hello All,
I would limke to add a GeoRSS layer from a local file as oppsed to a web server.
function
OnPageLoad(){
map =
new VEMap('myMap');map.LoadMap(
new VELatLong(43.85828, -79.3821), 10 ,'r' ,false);AddMyLayer(VELayerType.GeoRSS,
"file:///C:/geolayer.xml","test");}
function AddMyLayer(type, source, layerid){
var veLayerSpec = new VELayerSpecification();veLayerSpec.Type = type;
veLayerSpec.ID = layerid;
veLayerSpec.LayerSource = source;
veLayerSpec.Method =
'get';map.AddLayer(veLayerSpec);
}
However, I get an error when I do that. If I specify http://loaclhost/geolayer.xml or something like that for the LayerSource property then it works fine.
any ideas
TIA
Andrew

Adding a GeoRSS layer from a local file
Amit Bansal
Well my understanding of the Layer source property is that it's an AJAX XMLHttpRequest, so that in and of itself mandates the transport protocol. The property does support relative paths, which would be an option for storing the source xml files local to the website in some logical /data directory.
Another (.NET) option for you would be to set your layer source property to an HttpHandler that would 'handle' the aspect a) having knowledge of your server's physical file partitions and b) grabbing and streaming the xml back to the map control's internal parser.
haridorai
I got the same problem. I have to pass a local XML file.
function AddMyLayer(type, layerid)
{ var veLayerSpec = new VELayerSpecification();
veLayerSpec.Type = type;
veLayerSpec.ID = layerid;
veLayerSpec.LayerSource = "file:///C:/windows/temp/temp.xml";
veLayerSpec.Method = 'get';
map.AddLayer(veLayerSpec);
}
Can anyone tell me if this is possible
The asp handler (ashx) in this case don't work because the hanlder load the path (c:\windows\temp) of the server machine and not the local.
Ex:
The other way is pass the xml as a variable in argument of function:www.xxx.com/MyHandler.ashx url=file:///c:/windows/temp/temp.xml).
function AddMyLayer(type, xml, layerid) where xml is a xml document, but this also dont work because
" veLayerSpec.LayerSource " only accept an url and not a variable.
I need help...
Thanks..
buster
VBE_programmer
Hi Penny,
Thanks for the quick reply.
Perhaps my interpretation of URL is too broad :)
I always thought that file:///c:/somefile.htm is a URL as well. If indeed the layers must be loaded from an HTTP based url then that is a severe limitation.
Thanks,
Andrew
Aditya.P
Exactly. I have a xml file with GeoRSS info in a local path (p. ex: c:\windows\temp\temp.xml). And i have to call this path in LayerSource. But the LayerSource only accept an url and not a local path...
opera100
The xml file needs to be accessible over HTTP -- that is the requirement you are running into here; if you are doing VE development I am assuming you have a local instance of some web server running -- in which case that server instance would handle the HTTP request and file mapping on your local machine (Server.MapPath() in .net to handle the physical location on the drive). If you are deploying a VE application to a remote web server, then you'd need to wrap up something similar to the Windows Live Collection model where the GeoRSS files are upload-able and your js layer function again would reference their location via HTTP://yourwebserver/ etc.
So the long and short of it is wherever you put the xml file, if you can't type http://whatever/myfile.xml and see it in the browser, you're not going to be able to load it as a LayerSource inside your javascript.
Wayne Sepega
I am new to this and by no means an expert but the sdk documentation does state that the source property is expecting a URL.
" If layerType is set to VELayerType.GeoRSS, the LayerSource property specifies the URL of the source file for the layer."
I don't think that you can specify a file path.
Cheers,
Penny
Lima Beans