google.maps.KmlLayer class
A KmlLayer adds geographic markup to the map from a KML, KMZ or GeoRSS file that is hosted on a publicly accessible web server. A KmlFeatureData object is provided for each feature when clicked.
This class extends MVCObject.
Constructor
KmlLayer([opts])
Parameters:
- opts: KmlLayerOptions optional
Creates a KmlLayer which renders the contents of the specified KML/KMZ file (https://developers.google.com/kml/documentation/kmlreference) or GeoRSS file (http://www.georss.org).
Methods
getDefaultViewport()
Parameters: None
Return Value: LatLngBounds
Get the default viewport for the layer being displayed.
getMap()
Parameters: None
Return Value: Map
Get the map on which the KML Layer is being rendered.
getMetadata()
Parameters: None
Return Value: KmlLayerMetadata
Get the metadata associated with this layer, as specified in the layer markup.
getStatus()
Parameters: None
Return Value: KmlLayerStatus
Get the status of the layer, set once the requested document has loaded.
getUrl()
Parameters: None
Return Value: string
Gets the URL of the KML file being displayed.
getZIndex()
Parameters: None
Return Value: number
Gets the z-index of the KML Layer.
setMap(map)
Parameters:
- map: Map
Return Value: None
Renders the KML Layer on the specified map. If map is set to null, the layer is removed.
setOptions(options)
Parameters:
- options: KmlLayerOptions
Return Value: None
setUrl(url)
Parameters:
- url: string
Return Value: None
Sets the URL of the KML file to display.
setZIndex(zIndex)
Parameters:
- zIndex: number
Return Value: None
Sets the z-index of the KML Layer.
Events
function(kmlClickEvent)
Arguments:
- kmlClickEvent: KmlMouseEvent
This event is fired when a feature in the layer is clicked.
function()
Arguments: None
This event is fired when the KML layers default viewport has changed.
function()
Arguments: None
This event is fired when the KML layer has finished loading. At this point it is safe to read the status property to determine if the layer loaded successfully.