Select to view content in your preferred language

KML - File not found, wrong url error for correct url

1406
2
04-25-2012 04:20 AM
SujaSudhan
Deactivated User
Hi,

I am trying to add a kml layer to my map. However, the control reaches onError handler and shows 'File not found. Wrong Url' error. The Url is correct and I can get back data if I use it on a IE browser.

Why should the code fail with this error? Any input is appreciated.

Our server isn't accessible from outside. If I see in developer tools where the url is appended to http://utility.arcgis.com/sharing/kml?url=myurl ==> this returns File not found error and I am sure Kml layer isn't getting loaded because of this. But, how should I fix this?

Thanks!
0 Kudos
2 Replies
JeffPace
MVP Alum
Hi,

I am trying to add a kml layer to my map. However, the control reaches onError handler and shows 'File not found. Wrong Url' error. The Url is correct and I can get back data if I use it on a IE browser.

Why should the code fail with this error? Any input is appreciated.

Our server isn't accessible from outside. If I see in developer tools where the url is appended to http://utility.arcgis.com/sharing/kml?url=myurl ==> this returns File not found error and I am sure Kml layer isn't getting loaded because of this. But, how should I fix this?

Thanks!


KML must be on a public server

https://developers.google.com/maps/documentation/business/faq#intranet_kml

How do I render KML files that are hosted on intranet sites on a map?
The KmlLayer class that generates KML overlays in the Google Maps API uses a Google hosted service to retrieve and parse KML files for rendering. Consequently it is not possible to display KML files that are not hosted at a URL that is available publicly accessible, or that require authentication to access.

If you need to develop applications that use KML files hosted on intranet sites we recommend that you either:

Use the Google Earth API which supports client side parsing and rendering of KML.
Render the KML on the client side by using third-party JavaScript libraries. As the KML file is analyzed by the browser, performance may be lower than by using the KmlLayer class.
0 Kudos
derekswingley1
Deactivated User
As Jeff pointed out, KML files must be publicly accessible. This is documented here:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/kmllayer.htm
0 Kudos