The objective is to create a KMZ for Google Earth that I can serve up that accesses an ArcGIS Server map service with KML capability turned on (KMLServer) and control the initial visibility of the layers. However, NetworkLink does not honor the ArcMap visibility setting when set in the original map document (mxd); everything is simple set to visible on initial load.

Anyone have any idea(s) how I can control the visibility of the NetworkLink's sublayers (on initial load)?

I've considered using multiple NetworkLinks (as seen below) and using <visibility> but that solution isn't ideal since it creates a bit of a nested mess.
Multiple Network Linkes

  1. Create your layer structure - starting with a master folder. Include layer groups, nesting, etc. Set your network link URL to the ArcGIS Service KML link - this can be retrieved to going to the target ArcGIS Service, and choosing to export to KMZ. Make sure to choose all layers presented in the Service; and choose "Vector Layers as vector...".
    Example Image for obtaining Network Link.  Some items redacted. Open the resultant zip file, open the *.kml file within, and pull the link shown. It will look similar to this (: http://webserver/arcgis/services/Folder/Service/MapServer/KmlServer?Composite=false&LayerIDs=0%2C1%2C2
  2. Take the URL and Place in the network link URL
  3. Repeat for any additional layers
  4. Turn off any layers you wish to not display ("turn on") by default. A. This will change the following tag from 1 to 0
  5. Also change any other attributes under properties. See the following image to see this: Network Link Properties
  6. Right-click the Master folder and "Save as KMZ"
  7. If you want to edit the KMZ further: A. Open the KMZ file, extract the doc.kml file. B. Open the doc.kml file, make the edits, save/close, and replace the doc.kml within the KMZ file.

Update: You can also construct a Map Service query and paste the resulting URL/Query String into a network link if you wish to pull a sub-set of the map services layer(s) into Google Earth. Create a query with the output as HTML (this also ensures that the query parameters have been set correctly). Copy the resulting URL from the address box, and paste as a network link. Change the f=html text to f=kmz. For the "Return fields", always use * as the wildcard to have all fields brought over.

Caveat: I am doing this to, whenever possible, minimize the number of layers via definition queries for selected map services. I get good results on one set of "queried network links" against a map service, whereby the popup information box configuration set up in the originating map document carries over. Unfortunately, when trying this with another map service, the Popup box configuration does NOT carry over (it defaults to a generic table) despite (1) having the wildcard for returned fields and (2) the resultant query results' records displaying the correct popup configuration via the REST interface.

Edit: You will need to have ALL fields exposed (even those not used) for all features within the source Map Document or else the popup will not work properly.

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.