Select to view content in your preferred language

KML and KML network links still Broken?

1060
3
10-11-2011 05:33 AM
GarethEvans
Emerging Contributor
I have been trying to add a KML file with an embedded network link in it to my ArcGIS Online account. It works fine in AGX desktop and Google Earth, but gives me nothing when I upload it then try and view it in AG Online map viewer. I then tried the network link url. It worked great in AGX Desktop and Google Earth, nothing shows on the online map viewers (AGX and AG Online Viewer). http://geoserver.ecsecc.org/geoserver/wms/kml?layers=PSDP_CONSTRAINTS:Protected_Areas

I buy ArcGIS like I buy Microsoft - I get support and it integrates...... OK, but of a great line of potential tools so far integration has been terrible! I really think AG Online, AGX desktop and online and AG plug-in for sharepoint have excellent possibilities for integrated solutions that don't require a developer, but at every turn something works in one but is broken in another meaning I haven't been able to roll out an integrated ESRI solution as I had initially planned. Frustrating.
Tags (2)
0 Kudos
3 Replies
MikeMinami
Esri Notable Contributor
I understand your frustration, but hopefully we have a workable solution.

First, I'll ask the obvious question. Why are you embedding a WMS service inside a KML network link when you can add the WMS directly to ArcGIS Online? I was able to use the URL to the WMS and display it over the map. Adding a service avoids the need for the client (browser) to draw the features. In this particular case, the number of features is small, but this will probably be a better solution if you have a lot of data.

The reason your KML is not displaying is because we're not setting a default value for ViewFormat.

According to the spec:

http://code.google.com/apis/kml/documentation/kmlreference.html#link

If you specify a <viewRefreshMode> of onStop and do not include the <viewFormat> tag in the file, the following information is automatically appended to the query string:
BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]


ArcGIS Online is not automatically doing this. The workaround is straightforward. Add this parameter to your KML.

<?xml version="1.0" encoding="UTF-8"?>
<kml>
   <Folder>
      <NetworkLink>
         <name>PSDP_CONSTRAINTS:Protected_Areas</name>
         <open>1</open>
         <visibility>1</visibility>
         <Url>
            <href><![CDATA[http://geoserver.ecsecc.org:80/geoserver/wms?height=1024&width=1024&layers=PSDP_CONSTRAINTS:Protected_Areas&request=GetMap&service=wms&styles=Protected_Areas&format_options=SUPEROVERLAY:false;KMPLACEMARK:false;KMSCORE:40;KMATTR:true;&srs=EPSG:4326&format=application/vnd.google-earth.kmz&transparent=false&version=1.1.1]]></href>
            <viewRefreshMode>onStop</viewRefreshMode>
            <viewRefreshTime>1</viewRefreshTime>
            <viewFormat>BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]</viewFormat>
         </Url>
      </NetworkLink>
      <LookAt>
         <longitude>26.57877455914865</longitude>
         <latitude>-32.27249827641428</latitude>
         <altitude>0</altitude>
         <range>799671.4729535136</range>
         <tilt>0</tilt>
         <heading>0</heading>
         <altitudeMode>clampToGround</altitudeMode>
      </LookAt>
   </Folder>
</kml>


We'll try to address this in a subsequent release.

Hope this helps,

Mike
0 Kudos
GarethEvans
Emerging Contributor
Thanks Mike. The reason for using KML was to hopefully get access to the attributes (although it isn't clear in the documentation as to whether this will work) as the ESRI implementation of WMS doesn't provide access to the attributes as far as I can tell from forums.
0 Kudos
MikeMinami
Esri Notable Contributor
We don't currently support queries against WMS services. It's a good idea though. Adding it to a KML via a network link won't get the attributes either.

Mike
0 Kudos