FeatureLayer Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The FeatureLayer class represents a map layer containing features of a specific FeatureType whose style can be overridden on the client.
It includes interfaces for handling feature click events (OnFeatureClickListener) and defining styling (StyleFactory).
Public methods allow adding and removing click listeners, getting dataset and feature type IDs, retrieving and setting the style factory, and checking if the FeatureLayer is available.
Represents a map layer containing features of a specificFeatureType whose style can be overridden on the client.
Nested Class Summary
| interface | FeatureLayer.OnFeatureClickListener | A user-defined function that will be used to handleFeatureClickEvent. | |
| interface | FeatureLayer.StyleFactory | The style factory function applied to every polygon in the affected feature layer. | |
Public Method Summary
| void | addOnFeatureClickListener(FeatureLayer.OnFeatureClickListener listener) Sets a listener to respond to click events. |
| String | getDatasetId() Gets the datasetId of thisFeatureLayer. |
| FeatureLayer.StyleFactory | getFeatureStyle() Returns the FeatureLayer.StyleFactory of thisFeatureLayer |
| String | getFeatureType() Returns the FeatureType of thisFeatureLayer |
| boolean | isAvailable() Returns whether this FeatureLayer is available, which requires the data-driven styling capability to be available and theFeatureLayer to be enabled in the Cloud Console for the map style associated with this map's ID. |
| void | removeOnFeatureClickListener(FeatureLayer.OnFeatureClickListener listener) Removes a listener for this FeatureLayer. |
| void | setFeatureStyle(FeatureLayer.StyleFactory styleFactory) Sets a FeatureLayer.StyleFactory that will be used to style thisFeatureLayer. |
Inherited Method Summary
Public Methods
public voidaddOnFeatureClickListener(FeatureLayer.OnFeatureClickListener listener)
Sets a listener to respond to click events. Click events will not be triggered if thisFeatureLayer is not available.
publicStringgetDatasetId()
Gets thedatasetId of thisFeatureLayer.
publicFeatureLayer.StyleFactorygetFeatureStyle()
Returns theFeatureLayer.StyleFactory of thisFeatureLayer
publicStringgetFeatureType()
Returns theFeatureType of thisFeatureLayer
public booleanisAvailable()
Returns whether thisFeatureLayer is available, which requires the data-driven styling capability to be available and theFeatureLayer to be enabled in the Cloud Console for the map style associated with this map's ID. If this is false, styling on thisFeatureLayer returns to default and the click listeners are not called.
public voidremoveOnFeatureClickListener(FeatureLayer.OnFeatureClickListener listener)
Removes a listener for thisFeatureLayer.
public voidsetFeatureStyle(FeatureLayer.StyleFactory styleFactory)
Sets aFeatureLayer.StyleFactory that will be used to style thisFeatureLayer. If thisFeatureLayer is not available, styles will not be applied.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.