Select to view content in your preferred language

Add KMLLayer from local file

4693
2
Jump to solution
03-07-2013 12:20 AM
JeremieJoalland1
Deactivated User
I'm working on disconnected scenario (offline) and I'm trying to update KML Layer sample to add KML Layer from local kml file instead of the URL in example.

unfortunately, the kml content is not displayed on the map.

Is KMLLayer only working for "publicly accessible URL" ? it would be nice to be able to display kml file from local disk file...
I was also thinking of doing a Geoprocessing package with tool "KML To Layer", but this tool is not licenced for Runtime, does ESRI plan to licence it in next release ?

my code doesn't create error, the layer is added, but there is no KML content displayed :
final KMLLayer kmlLayer = new KMLLayer("C:\\KML_Samples.kml", map.getSpatialReference());     layers.add(kmlLayer);
0 Kudos
1 Solution

Accepted Solutions
MarkBaird
Esri Regular Contributor
The KML Layer is designed to work from a http source, so unless you can serve it via a local web server (like apache) then you don't be able to read KML from a local file.  This is noted in the Java Doc.

However, I've noted this as a limitation which could be improved in a futre release

Mark

View solution in original post

0 Kudos
2 Replies
MarkBaird
Esri Regular Contributor
The KML Layer is designed to work from a http source, so unless you can serve it via a local web server (like apache) then you don't be able to read KML from a local file.  This is noted in the Java Doc.

However, I've noted this as a limitation which could be improved in a futre release

Mark
0 Kudos
NeilAcantilado1
New Contributor

Was searching the forums and this thread was relevant to me.  (I'm using the ArcGIS API for JavaScript 3.38, BTW.)  I'm having the problem that I am indeed "serving" up KML via a local web server but am getting "File not found. Wrong url or out of memory" errors.  I think my issue is that my local web server is not "publicly accessible" but is on a closed network.  We do have our own ArcGIS Portal installed on our "closed" network, etc.  Just wanted to know if this was my issue.

0 Kudos