This page describes an older version, please see latest API at http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/KMLLayer.html.
Packagecom.esri.ags.layers
Classpublic class KMLLayer
InheritanceKMLLayer Inheritance Layer Inheritance mx.core.UIComponent
Implements ILegendSupport

The KMLLayer is used to create a layer based on a publicly accessible KML file (.kml,.kmz). KML is an XML-based file format used to represent geographic features. Features from the KML file are accessible via the api so you can query features and use them as input to geometry or geoprocessing services.

Support for HTML in the description is limited to what Flash platform supports: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#htmlText.

See also

The KML Standard (OGC)
KML Reference on Google Code


Public Properties
 PropertyDefined By
  description : String
Description as defined by the kml file.
KMLLayer
  disableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.
KMLLayer
  featureInfos : Array
[read-only] An array of objects that describe top-level KML features ids and their types.
KMLLayer
  folders : Array
[read-only] An array of KMLFolder objects that describe the folders and nested folders defined in the KML file.
KMLLayer
  groundOverlays : Array
[read-only] Array of KMLGroundOverlay instances.
KMLLayer
  initialExtent : Extent
[override] [read-only] Initial extent as defined by the map service.
KMLLayer
 InheritedisInScaleRange : Boolean
[read-only] Returns true if the current scale of the map is between the maximum and minimum scale of the layer [added in version 1.3].
Layer
  layers : Array
[read-only] Array of map layers that the KML layer creates to draw placemarks and ground overlays.
KMLLayer
 Inheritedloaded : Boolean
[read-only] When the layer is loaded, the value becomes "true" and layer properties can be accessed.
Layer
 InheritedloadFault : Fault
[read-only] A reference to the fault that is dispatched when the layer throws a loadError event.
Layer
 Inheritedmap : Map
[read-only] A reference to the Map this layer is in.
Layer
 InheritedmaxScale : Number
The maximum scale of the layer [added in version 1.3].
Layer
 InheritedminScale : Number
The minimum scale of the layer [added in version 1.3].
Layer
  networkLinks : Array
[read-only] Array of KMLLayer instances.
KMLLayer
  requestTimeout : int
The request timeout in seconds.
KMLLayer
  respectFeatureVisibility : Boolean
If true, respects the visibility of each feature within a folder.
KMLLayer
  screenOverlays : Array
[read-only] Array of KMLScreenOverlay instances.
KMLLayer
  serviceURL : String
URL to utility service for converting KML files to features.
KMLLayer
  snippet : String
Snippet
KMLLayer
 InheritedspatialReference : SpatialReference
[read-only] The spatial reference of the layer.
Layer
 Inheritedunits : String
[read-only] The units of the layer.
Layer
  url : String
The url for a .kml or .kmz file.
KMLLayer
Public Methods
 MethodDefined By
  
KMLLayer(url:String = null)
Creates a new KMLLayer based on a publicly accessible URL.
KMLLayer
  
getFeature(featureInfo:KMLFeatureInfo):Object
Returns the KML feature identified by the given feature info.
KMLLayer
  
getLegendInfos(responder:IResponder = null):AsyncToken
Gets legend infos.
KMLLayer
 Inherited
refresh():void
Causes the layer to redraw or reload its content.
Layer
  
setFolderVisibility(folder:KMLFolder, isVisible:Boolean):void
Sets the visibility of the given folder.
KMLLayer
Protected Methods
 MethodDefined By
 Inherited
Adds listeners for ExtentEvent.EXTENT_CHANGE, ZoomEvent.ZOOM_START, ZoomEvent.ZOOM_UPDATE and ZoomEvent.ZOOM_END.
Layer
 Inherited
When an EXTENT_CHANGE event occurs, this calls invalidateLayer();
Layer
 Inherited
hideHandler(event:FlexEvent):void
When the layer is hidden (visible is set to false), this calls removeMapListeners().
Layer
 Inherited
Subclasses should call this whenever they would like to have updateLayer() called on them.
Layer
 Inherited
Removes all the layers children.
Layer
 Inherited
Removes the four event listeners added by addMapListeners();
Layer
 Inherited
setLoaded(value:Boolean):void
Subclasses must call this when they've loaded all their properties and are ready to load their content.
Layer
 Inherited
showHandler(event:FlexEvent):void
When the layer is shown (visible is set to true), this calls addMapListeners() and invalidateLayer().
Layer
 Inherited
toScreenX(mapX:Number):Number
Converts the x-coordinate of map point to a screen point.
Layer
 Inherited
toScreenY(mapY:Number):Number
Converts the y-coordinate of map point to a screen point.
Layer
 Inherited
Subclasses must override this method.
Layer
 Inherited
Finishes the zoom animation.
Layer
 Inherited
Prepares the zoom animation by taking a bitmap of the layer.
Layer
 Inherited
Redraws the bitmap of the layer.
Layer
Events
 Event Summary Defined By
 InheritedFires if the value of isInScaleRange changes.Layer
 InheritedFires after layer properties for the layer are successfully populated.Layer
 InheritedFires if the layer is unable to load.Layer
 InheritedFires when the layer has finished updating its content.Layer
 InheritedFires when the layer begins to update its content.Layer
Property Detail
descriptionproperty
description:String

Description as defined by the kml file.

This property can be used as the source for data binding.


Implementation
    public function get description():String
    public function set description(value:String):void
disableClientCachingproperty 
disableClientCaching:Boolean

If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.

The default value is false.

This property can be used as the source for data binding.


Implementation
    public function get disableClientCaching():Boolean
    public function set disableClientCaching(value:Boolean):void
featureInfosproperty 
featureInfos:Array  [read-only]

An array of objects that describe top-level KML features ids and their types.

This property can be used as the source for data binding.


Implementation
    public function get featureInfos():Array

See also

foldersproperty 
folders:Array  [read-only]

An array of KMLFolder objects that describe the folders and nested folders defined in the KML file. Use the parentFolderId and subFolderIds to identify the hierarchical relationship between folders.

This property can be used as the source for data binding.


Implementation
    public function get folders():Array

See also

groundOverlaysproperty 
groundOverlays:Array  [read-only]

Array of KMLGroundOverlay instances.

This property can be used as the source for data binding.


Implementation
    public function get groundOverlays():Array

See also

initialExtentproperty 
initialExtent:Extent  [read-only] [override]

Initial extent as defined by the map service. Used by the map if it is the first layer in the map and map doesn't have an extent specified.

This property can be used as the source for data binding.


Implementation
    public function get initialExtent():Extent
layersproperty 
layers:Array  [read-only]

Array of map layers that the KML layer creates to draw placemarks and ground overlays. The array contains instances of the following layer types: FeatureLayer and MapImageLayer.

This property can be used as the source for data binding.


Implementation
    public function get layers():Array

See also

networkLinksproperty 
networkLinks:Array  [read-only]

Array of KMLLayer instances.

This property can be used as the source for data binding.


Implementation
    public function get networkLinks():Array
requestTimeoutproperty 
requestTimeout:int

The request timeout in seconds. A value less than or equal to zero prevents request timeout.

The default value is -1.

This property can be used as the source for data binding.


Implementation
    public function get requestTimeout():int
    public function set requestTimeout(value:int):void
respectFeatureVisibilityproperty 
respectFeatureVisibility:Boolean

If true, respects the visibility of each feature within a folder.

The default value is false.

This property can be used as the source for data binding.


Implementation
    public function get respectFeatureVisibility():Boolean
    public function set respectFeatureVisibility(value:Boolean):void
screenOverlaysproperty 
screenOverlays:Array  [read-only]

Array of KMLScreenOverlay instances.

This property can be used as the source for data binding.


Implementation
    public function get screenOverlays():Array

See also

serviceURLproperty 
serviceURL:String

URL to utility service for converting KML files to features.

The default value is http://utility.arcgis.com/sharing/kml.

This property can be used as the source for data binding.


Implementation
    public function get serviceURL():String
    public function set serviceURL(value:String):void
snippetproperty 
snippet:String

Snippet

This property can be used as the source for data binding.


Implementation
    public function get snippet():String
    public function set snippet(value:String):void
urlproperty 
url:String

The url for a .kml or .kmz file.

This property can be used as the source for data binding.


Implementation
    public function get url():String
    public function set url(value:String):void
Constructor Detail
KMLLayer()Constructor
public function KMLLayer(url:String = null)

Creates a new KMLLayer based on a publicly accessible URL.

Parameters
url:String (default = null)
Method Detail
getFeature()method
public function getFeature(featureInfo:KMLFeatureInfo):Object

Returns the KML feature identified by the given feature info.

Parameters

featureInfo:KMLFeatureInfo

Returns
Object
getLegendInfos()method 
public function getLegendInfos(responder:IResponder = null):AsyncToken

Gets legend infos.

Parameters

responder:IResponder (default = null) — The responder to call on result or fault. The result function will be given an Array of LayerLegendInfo instances.

Returns
AsyncToken

See also

setFolderVisibility()method 
public function setFolderVisibility(folder:KMLFolder, isVisible:Boolean):void

Sets the visibility of the given folder. All kml features within that folder will be affected.

Parameters

folder:KMLFolder
 
isVisible:Boolean