Adding Layers from local drive

561
1
09-05-2010 07:21 AM
GeoInformatik
New Contributor
Hello,
I want to add layers to my map with JavaScript API. There are some examples in the Resource Center "Creating a custom tiled layer type" title such as;

"This function adds the layer to the map."
function init() {
  var map = new esri.Map("map");
  map.addLayer(new my.PortlandTiledMapServiceLayer());
}


But, I want to add my layers from my local drive (C:\), because I want to open my map in a browser without internet access. How can I do this, can you give a sample code?

Thanks.
0 Kudos
1 Reply
AxelSchaefer
New Contributor II
There are some posts regarding the upload of local files to a JS API application. Most of them rely on a web-service for a) uploading the file and b) providing it to the JS API app via an URL. In general, security reasons and the HTTP protocol don't allow you to upload files to a JS application directly. A web-service - based on .NET, Java, PHP, Perl or anything else - allows uploading a file via HTTP. The Flex and Silverlight APIs behave different and the possibilities for accessing local data are greater. But for JavaScript I don't see a way for not using a service in the backend.

Hope that helps.
Axel
0 Kudos