FeatureLayer

  • 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.

public final classFeatureLayer extendsObject

Represents a map layer containing features of a specificFeatureType whose style can be overridden on the client.

Nested Class Summary

interface FeatureLayer.OnFeatureClickListenerA user-defined function that will be used to handleFeatureClickEvent
interface FeatureLayer.StyleFactoryThe 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 thedatasetId of thisFeatureLayer.
FeatureLayer.StyleFactory
String
boolean
isAvailable()
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.
void
void
setFeatureStyle(FeatureLayer.StyleFactory styleFactory)
Sets a FeatureLayer.StyleFactory that will be used to style thisFeatureLayer.

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

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()

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.