You are on page 1of 24

KML in ArcGIS Server 9.

9.3 Tech Transfer Sessions

Outline :
The Consumers View of the Servers KML capabilities at 9.3 End Users Web Page Developers The Publishers View of the Servers KML capabilities at 9.3 The Authors View of the Servers KML capabilities at 9.3

ArcGIS Server KML The End Users View

Web Pages that contain links to kml content (that happens to come from an ArcGIS Server )

Services Explorer pages that contain links to :


The kml footprints of map and image services The kml raster representation for any map or image service.

ArcGIS Server KML - The End Users View: Demo

Web pages with links to content


Fire Response National Hurricane Center National Geocoder

Using Services Explorer View Footprints View Services Search for pages populate service descriptions

Using KML from an ArcGIS Server The Web Page Developers View Web Page Developers can build pages that contain links to kml content that comes from an ArcGIS Server Web Page Developers use the REST API to construct urls that deliver kml
The footprints of map and image services The fused raster representation for any map or image service Custom raster or vector compositions corresponding to selected layers from a map service The results of queries that they define The results of geoprocessing tasks that they invoke The results of geocoding operations that they execute
5

KML Rest API - The Web Page Developers View : Spatial Footprints

URL to spatial footprints of all services in a folder as KMZ


http://<root>/<folder>?f=kmz

Example : http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics?f= kmz Includes some service level metadata

KML Rest API - The Web Page Developers View : Fused Raster Representations

URL to the fused raster representation of a Map Service that includes all its layers as a network link KMZ :
http://<root>/<folder>/<name>/MapServer/kml/mapImage.kmz

If cached and in WGS84 or Mercator you get a KML SuperOverlay (Regionated KML)
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland /Portland_ESRI_LandBase_AGO/MapServer/kml/mapImage.kmz

Else you get a KML Ground Overlay http://myHost/ArcGIS/rest/services/SoCalFires2007Dyna mic/MapServer/kml/mapImage.kmz


7

KML Rest API - The Web Page Developers View : Fused Raster Representations contd. URL to the raster representation of an Image Service as a network link KMZ
http://<root>/<folder>/<name>/ImageServer/kml/mapImage.kmz

KML REST API The Web Page Developers View : Query, Geocode and Geoprocessing results as KML

Query layers in a map and get results as KML


http://<map-service>/<layer>/Query?<params>&f=kmz http://myHost/ArcGIS/rest/services/HTB/MapServer/0/query?geometryType=esriGe ometryEnvelope&spatialRel=esriSpatialRelIntersects&where=year+%3D+1940&ret urnGeometry=true&f=kmz

Get results of Geocode operations as KMZ


http://<geocode-service>/findAddressCandidates?<params>&f=kmz http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Locators/ESRI_Geoco de_USA/GeocodeServer/findAddressCandidates?Address=380+New+York+Street &City=Redlands&State=California&Zip=92373&f=kmz

Get results of Geoprocessing results as KMZ


http://<geoprocessing-service>/Execute?<params>&fmt=kmz Get Data for a completed synchronous task as KMZ

http://myServer/ArcGIS/rest/services/MessageInABottle/GPServer/Mes sage%20in%20a%20bottle/execute?Input_Point=150+20&Days=150&env%3AoutSR=&env%3AprocessSR=&f=kmz
9

KML REST API The Web Page Developers View : Custom compositions built from the layers in a map service

Build custom compositions using the GenerateKML operation :


Select individual layers Mix raster and vector representations Include legends published along with the map Returns a Network Link http://<map-service>/generateKML Example http://myServer/ArcGIS/rest/services/Germany/MapServer/generatek ml?docName=&layers=-1&layerOptions=nonComposite

10

ArcGIS Server KML The Publishers View At 9.3 KML is automatically available via the REST API when you publish a service :
Service footprints are automatically available to consumers as KML. The fused raster representation of any map or image service is automatically available to consumers in KML. Query, Geocoding and Geoprocessing results are automatically available to web developers in KML By default, Web developers also have the ability to create KML compositions that dynamically fuse selected layers in a map service.

You can also continue to use Manager to explicitly author and publish KML network links as at 9.2

ArcGIS Server 9.3 The Publishers View

The REST API uses the KML capability of the Map Service

The KML capability is turned on by default at 9.3 Certain REST Operations are not supported if the KML capability is turned off.
Composition

The 9.2 URL for the KML capability (kmlserver) continues to be supported for backward compatibility
http://myServer/arcgis/services/Germany/MapServer/kmlServer?Composite=True>

12

The Publishers View: ArcGIS Manager Experience Demos:


Creating a Network Link Document using Manager

ArcGIS Server KML The Authors View ArcGIS 9.3 gives you additional options for configuring the content and appearance of your features in KML.
The KML Description for a feature is now based on the HTML Popup configured for the feature layer in ArcMap. Point features are no longer automatically labeled. Labeling size and color is now honored in all cases where the server returns features as point vector placemarks. New help on authoring layers for KML

ArcGIS Server KML The Authors View The KML Description of the feature and its symbology are honored in all cases where the server returns features as vector placemarks
Queries, Geoprocessing Results, Vector Compositions

You can include a legend in the layout of a published map document that will be exposed to consumers as a Legend (KML ScreenOverlay) positioned in screen space of a KML client at the consumers discretion.

ArcGIS Server KML The Authors View: HTML Popup KML Descriptions are populated using an xsl template and feature data. Accept default xsl template or create one.

ArcGIS Server KML The Authors View: Point Feature Labeling Points are labeled only if explicitly specified to do so. Label color and size are honored.

ArcGIS Server KML The Authors View: Legends Any legends authored in the layout view will be exported for generateKML and Network Links authored in Manager.

ArcGIS Server KML The Authors View: Legends Legends can be placed at any of 9 cardinal screen locations in the KML client at the discretion of the end user.

Deep Dive 1: Authoring Maps for KML export Authoring Maps for KML export
Configuring Layer, Feature and Legend Export Properties
Rendering/Labeling/Descriptions/Legends HTML Popup derive custom xsl style templates from those provided in %ArcGISInstallDir%\Styles\HTMLPopup Example: Show inline images from fields with URLs to JPG images
<xsl:choose>

<xsl:when test="FieldValue[contains(., '.jpg')]"> <IMG><xsl:attribute name="src"><xsl:value-of select="FieldValue"/></xsl:attribute></IMG> </xsl:when>


<xsl:otherwise> <xsl:value-of select="FieldValue"/> </xsl:otherwise> </xsl:choose>

Deep Dive 2: Hurricane Impact ArcGIS Server Query and GP results in KML
Create an HTML Form with action = URL to the REST MapService Query Layer operation and method = get. Edit XSL template for MapService Hurricane tracks layer to create an HTML Anchor URL to the REST GP Execute Task with query string parameters culled from Feature Class Field values. Use Default HTML Popup for GP Tool Layer File

Deep Dive 2: Hurricane Impact Create an HTML Form


<form name="hurricaneSearchForm" action="http://myHost/ArcGIS/rest/services/HTB/MapServer /0/query" method="get"> <input id="txtYear" type="text" value="2005" name="year/> <input id="hiddenGeometryType" type="hidden" value="esriGeometryEnvelope" name="geometryType"/> <A href="javascript: submitForm()">Submit</A> http://myHost/ArcGIS/rest/services/HTB/MapServer/0/query? geometryType=esriGeometryEnvelope&inSR=&spatialRel= esriSpatialRelIntersects&where=YEAR%3D2005R&f=html

Deep Dive 2: Hurricane Impact Edit XSL template


<xsl:variable name="baseURL">http://myHost/ArcGIS/rest/services/HTB/GPServer/ Buffer Hurricane Tracks/execute</xsl:variable> <xsl:variable name="name"> <xsl:for-each select="FieldsDoc/Fields/Field"> <xsl:if test="FieldName[contains(., 'NAME')]"> <xsl:value-of select="FieldValue"/> </xsl:if> </xsl:for-each> </xsl:variable> <A target="_blank" HREF="{$baseURL}?Hurricane_Name={$name}&amp;Year={$year}&am p;Distance=&amp;env:outSR=&amp;env:AprocessSR=&amp;f=kmz">Fin d people affected within 50 Miles.</A>

Questions?

You might also like