Data-driven styling (beta)

FeatureLayer interface

google.maps.FeatureLayer interface

An interface representing a map layer containing features of a specific FeatureType whose style can be overridden client-side, or have events attached.

featureType
Type:  FeatureType
The FeatureType associated with this FeatureLayer.
isAvailable
Type:  boolean
Whether this FeatureLayer is available, meaning whether Data-driven styling is available for this map (there is a map ID using vector tiles with this FeatureLayer enabled in the Google Cloud Console map style.) If this is false (or becomes false), styling on this FeatureLayer returns to default and events are not triggered.
style optional
The style of Features in the FeatureLayer. The style is applied when style is set. If your style function updates, you must set the style property again. A FeatureStyleFunction must return consistent results when it is applied over the map tiles, and should be optimized for performance. If you use a FeatureStyleOptions, all features of that layer will be styled with the same FeatureStyleOptions. Set the style to null to remove the previously set style. If this FeatureLayer is not available, setting style does nothing and logs an error.
addListener
addListener(eventName, handler)
Parameters: 
  • eventNamestring Observed event.
  • handlerFunction Function to handle events.
Return Value:  MapsEventListener Resulting event listener.
Adds the given listener function to the given event name. Returns an identifier for this listener that can be used with event.removeListener.

FeatureType constants

google.maps.FeatureType constants

Identifiers for feature types.

ADMINISTRATIVE_AREA_LEVEL_1 Indicates a first-order civil entity below the country level.
ADMINISTRATIVE_AREA_LEVEL_2 Indicates a second-order civil entity below the country level.
ADMINISTRATIVE_AREA_LEVEL_3 Indicates a third-order civil entity below the country level.
ADMINISTRATIVE_AREA_LEVEL_4 Indicates a fourth-order civil entity below the country level.
COUNTRY Indicates the national political entity.
LOCALITY Indicates an incorporated city or town political entity.
NEIGHBORHOOD Indicates a named neighborhood.
POSTAL_CODE Indicates a postal code as used to address postal mail within the country.
SUBLOCALITY_LEVEL_1 Indicates a first-order civil entity below a locality.

FeatureStyleFunction typedef

google.maps.FeatureStyleFunction typedef

A function to style a FeatureLayer.

function(FeatureStyleFunctionOptions): (FeatureStyleOptions optional)

FeatureStyleFunctionOptions interface

google.maps.FeatureStyleFunctionOptions interface

Options passed to a FeatureStyleFunction.

feature
Type:  Feature
Feature passed into the FeatureStyleFunction for styling.

FeatureStyleOptions interface

google.maps.FeatureStyleOptions interface

These options specify the way the style of a Feature should be modified on a map.

fillColor optional
Type:  string optional
Hex RGB string (like "#00FF00" for green). Only applies to polygon geometries.
fillOpacity optional
Type:  number optional
The fill opacity between 0.0 and 1.0. Only applies to polygon geometries.
strokeColor optional
Type:  string optional
Hex RGB string (like "#00FF00" for green).
strokeOpacity optional
Type:  number optional
The stroke opacity between 0.0 and 1.0. Only applies to line and polygon geometries.
strokeWeight optional
Type:  number optional
The stroke width in pixels. Only applies to line and polygon geometries.

Feature interface

google.maps.Feature interface

An interface representing a vector map tile feature. These are inputs to the FeatureStyleFunction. Do not save a reference to a particular Feature object because the reference will not be stable.

featureType
Type:  FeatureType
FeatureType of this Feature.

PlaceFeature interface

google.maps.PlaceFeature interface

An interface representing a feature with a place ID which includes features of type FeatureType.ADMINISTRATIVE_AREA_LEVEL_1, FeatureType.ADMINISTRATIVE_AREA_LEVEL_2, FeatureType.ADMINISTRATIVE_AREA_LEVEL_3, FeatureType.ADMINISTRATIVE_AREA_LEVEL_4, FeatureType.COUNTRY, FeatureType.LOCALITY, FeatureType.NEIGHBORHOOD, FeatureType.POSTAL_CODE, and FeatureType.SUBLOCALITY_LEVEL_1.

This interface extends Feature.

displayName
Type:  string
The display name.
placeId
Type:  string
Inherited: featureType

FeatureMouseEvent interface

google.maps.FeatureMouseEvent interface

This object is returned from a mouse event on a FeatureLayer.

This interface extends MapMouseEvent.

features
Type:  Array<Feature>
The Features at this mouse event.
Inherited: domEvent, latLng
Inherited: stop