Serving Kml With Arcgis Server 9-3

24
9.3 Tech Transfer Sessions 9.3 Tech Transfer Sessions 1 1 KML in KML in ArcGIS ArcGIS Server 9.3 Server 9.3

Transcript of Serving Kml With Arcgis Server 9-3

Page 1: Serving Kml With Arcgis Server 9-3

9.3 Tech Transfer Sessions9.3 Tech Transfer Sessions 11

KML in KML in ArcGISArcGIS Server 9.3Server 9.3

Page 2: Serving Kml With Arcgis Server 9-3

• Outline :

–The Consumer’s View of the Server’s KML capabilities at 9.3• End Users• Web Page Developers

–The Publisher’s View of the Server’s KML capabilities at 9.3

–The Author’s View of the Server’s KML capabilities at 9.3

Page 3: Serving Kml With Arcgis Server 9-3

ArcGIS Server KML – The End User’s 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.

Page 4: Serving Kml With Arcgis Server 9-3

ArcGIS Server KML - The End User’s 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

Page 5: Serving Kml With Arcgis Server 9-3

55

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 urlsthat 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

Page 6: Serving Kml With Arcgis Server 9-3

66

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

Page 7: Serving Kml With Arcgis Server 9-3

77

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 Super-Overlay (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

Page 8: Serving Kml With Arcgis Server 9-3

88

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

Page 9: Serving Kml With Arcgis Server 9-3

99

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=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&where=year+%3D+1940&returnGeometry=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_Geocode_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

Page 10: Serving Kml With Arcgis Server 9-3

1010

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

• Build custom compositions using the GenerateKMLoperation :– Select individual layers– Mix raster and vector representations– Include legends published along with the map– Returns a Network Link

http://<map-service>/generateKML

Examplehttp://myServer/ArcGIS/rest/services/Germany/MapServer/generatek

ml?docName=&layers=-1&layerOptions=nonComposite

Page 11: Serving Kml With Arcgis Server 9-3

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

Page 12: Serving Kml With Arcgis Server 9-3

1212

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>

Page 13: Serving Kml With Arcgis Server 9-3

The Publisher’s View: ArcGIS Manager Experience

Demos:

– Creating a Network Link Document using Manager

Page 14: Serving Kml With Arcgis Server 9-3

ArcGIS Server KML – The Author’s 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

Page 15: Serving Kml With Arcgis Server 9-3

ArcGIS Server KML – The Author’s 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 consumer’s discretion.

Page 16: Serving Kml With Arcgis Server 9-3

ArcGIS Server KML – The Author’s View:HTML Popup• KML Descriptions are populated using an xsl template

and feature data.• Accept default xsl template or create one.

Page 17: Serving Kml With Arcgis Server 9-3

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

Page 18: Serving Kml With Arcgis Server 9-3

ArcGIS Server KML – The Author’s View:Legends• Any legends authored in the layout view will be exported for

generateKML and Network Links authored in Manager.

Page 19: Serving Kml With Arcgis Server 9-3

ArcGIS Server KML – The Author’s View:Legends• Legends can be placed at any of 9 cardinal screen locations

in the KML client at the discretion of the end user.

Page 20: Serving Kml With Arcgis Server 9-3

Deep Dive 1: Authoring Maps for KML exportAuthoring Maps for KML exportConfiguring 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>

Page 21: Serving Kml With Arcgis Server 9-3

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

Page 22: Serving Kml With Arcgis Server 9-3

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

Page 23: Serving Kml With Arcgis Server 9-3

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}&amp;Distance=&amp;env:outSR=&amp;env:AprocessSR=&amp;f=kmz">Find people affected within 50 Miles.</A>

Page 24: Serving Kml With Arcgis Server 9-3

Questions?