0

I want to add a KML file, hosted internally on a server, as operationallayers. It doesn't seem to be working.

If I put the KML file in Google Drive or Github and then call it like :

{  
            type: 'kml',
            url: 'http://googlemaps.github.io/js-v2-samples/ggeoxml/cta.kml',
            title: 'Quakes2',
            options: {
                id: 'quake_kml',
                opacity: 1.0,
                visible: true,
                //imageParameters: imageParameters
                mode: 0
            },
            identifyLayerInfos: {
                //layerIds: [0]
            },
            legendLayerInfos: {
                layerInfo: {
                }
            },
            layerControlLayerInfos: {
                swipe: true,
                metadataUrl: true,
                expanded: true
            }
  } 

. It works. If i change to "url: 'http://localhost/mykml/cta.kml'", it doesn't work. But I don't want to put my resource on outside premises.

How can I put this KML file on my internal network so that I can call it in my app?

I have read about KML parser called geoxml3, but I don't know how to convert the result of geoxml3 so that it can be passed to my CMV app. Any ideas?

  • What are you trying to load/visualize the KML in? Google Maps API? Some other API or map renderer? If it's Google Maps, then the file will need to be publicly accessible, since Google Maps needs to be able to fetch the KML from a public URL in order to render it for serving back to the client map. – Christiaan Adams Mar 26 at 15:31
  • I am trying to load the KML in CMV (arcgis js api). The KML works if hosted outside but not inside (internal web server). I am thinking a work around to enable KML hosted internally. – padjee Mar 27 at 0:33
0

As mentioned in the Esri API documentation for the KMLLayer, you will have to create your own utility service using Portal:

Note: The KMLLayer uses a utility service from ArcGIS.com, therefore your kml/kmz must be publicly accessible on the internet. If your kml/kmz files are behind the firewall you will need to set the esriConfig.defaults.kmlService to your own utility service. (Requires Portal for ArcGIS).

https://developers.arcgis.com/javascript/3/jsapi/kmllayer-amd.html

  • hi tim. i have read it but can't understand what it means. Where can i find this "esriConfig.defaults.kmlService" ? Where to put it within the Portal for Arcgis ? Is this portal hosted locally ? Can you please elaborate on this , more like a step by step ? thanks – padjee Apr 1 at 2:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.