google-maps-documentation

KmlLayer class

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
KmlLayer([opts])
Parameters: 
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
getDefaultViewport()
Parameters:  None
Return Value:  LatLngBounds
Get the default viewport for the layer being displayed.
getMap
getMap()
Parameters:  None
Return Value:  Map
Get the map on which the KML Layer is being rendered.
getMetadata
getMetadata()
Parameters:  None
Return Value:  KmlLayerMetadata
Get the metadata associated with this layer, as specified in the layer markup.
getStatus
getStatus()
Parameters:  None
Return Value:  KmlLayerStatus
Get the status of the layer, set once the requested document has loaded.
getUrl
getUrl()
Parameters:  None
Return Value:  string
Gets the URL of the KML file being displayed.
getZIndex
getZIndex()
Parameters:  None
Return Value:  number
Gets the z-index of the KML Layer.
setMap
setMap(map)
Parameters: 
Return Value:  None
Renders the KML Layer on the specified map. If map is set to null, the layer is removed.
setOptions
setOptions(options)
Parameters: 
Return Value:  None
setUrl
setUrl(url)
Parameters: 
  • urlstring
Return Value:  None
Sets the URL of the KML file to display.
setZIndex
setZIndex(zIndex)
Parameters: 
  • zIndexnumber
Return Value:  None
Sets the z-index of the KML Layer.
Events
click
function(kmlClickEvent)
Arguments: 
This event is fired when a feature in the layer is clicked.
defaultviewport_changed
function()
Arguments:  None
This event is fired when the KML layers default viewport has changed.
status_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.