<iframe src="https://developers.devsite.google/frame/maps/documentation/javascript/reference/data-driven-styling_3e30b02c87c94b7f8ad9859cabf1b2363d79ae209b8d306ea59f322bfb250378.frame" class="framebox inherit-locale redirect-iframe" allow="clipboard-write https://developers.devsite.google" allowfullscreen is-upgraded></iframe>

## [FeatureLayer](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#FeatureLayer)
interface


interface
`google.maps.FeatureLayer`

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

| ### Properties ||
|---|---|
| `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. |
| `![Beta](data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M20.21,17.64l-6.15-8.22V5.57h2.57V3H6.35v2.57h2.57v3.86l-6.3,8.4c-0.44,0.6-0.5,1.41-0.15,2.08C2.8,20.58,3.49,21,4.24,21h14.5c1.11,0,2.01-0.9,2.01-2.01C20.75,18.48,20.53,18,20.21,17.64z' fill='%2301579b'/%3E%3C/svg%3E "Beta")datasetId` optional | > [!WARNING] > **Notice:** Available only in the [v=beta channel](https://developers.google.com/maps/documentation/javascript/versions.md.txt#choosing-the-beta-channel). **Type:** `string optional` The Dataset ID for this `FeatureLayer`. Only present if the `featureType` is `FeatureType.DATASET`. |
| `style` optional | **Type:** `FeatureStyleOptions|FeatureStyleFunction optional` The style of `Feature`s 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. Asynchronous functions are not supported. 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. |

| ### Methods ||
|---|---|
| `addListener` | `addListener(eventName, handler)` **Parameters:** - `eventName: string` Observed event. - `handler: Function` 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`. |

| ### Events ||
|---|---|
| `click` | `function(event)` **Arguments:** - `event: FeatureMouseEvent` This event is fired when the `FeatureLayer` is clicked. |
| `mousemove` | `function(event)` **Arguments:** - `event: FeatureMouseEvent` This event is fired when the user's mouse moves over the `FeatureLayer`. |

## [FeatureType](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#FeatureType)
constants


constants
`google.maps.FeatureType`

library `"maps"`

Identifiers for feature types.

These constants are also usable as strings. In TypeScript, the string literals are defined by the `FeatureTypeString` type.

```javascript
const {FeatureType} = await google.maps.importLibrary("maps");
```

| ### Constants ||
|---|---|
| `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. |
| `COUNTRY` | Indicates the national political entity. |
| `![Beta](data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M20.21,17.64l-6.15-8.22V5.57h2.57V3H6.35v2.57h2.57v3.86l-6.3,8.4c-0.44,0.6-0.5,1.41-0.15,2.08C2.8,20.58,3.49,21,4.24,21h14.5c1.11,0,2.01-0.9,2.01-2.01C20.75,18.48,20.53,18,20.21,17.64z' fill='%2301579b'/%3E%3C/svg%3E "Beta")DATASET` | > [!WARNING] > **Notice:** Available only in the [v=beta channel](https://developers.google.com/maps/documentation/javascript/versions.md.txt#choosing-the-beta-channel). Indicates a third-party dataset. |
| `LOCALITY` | Indicates an incorporated city or town political entity. |
| `POSTAL_CODE` | Indicates a postal code as used to address postal mail within the country. Includes zip codes. |
| `SCHOOL_DISTRICT` | Indicates a school district. |

## [FeatureStyleFunction](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#FeatureStyleFunction)
typedef


typedef
`google.maps.FeatureStyleFunction`

A function to style a `FeatureLayer`.

`function(FeatureStyleFunctionOptions): (FeatureStyleOptions optional)`

## [FeatureStyleFunctionOptions](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#FeatureStyleFunctionOptions)
interface


interface
`google.maps.FeatureStyleFunctionOptions`

Options passed to a `FeatureStyleFunction`.

| ### Properties ||
|---|---|
| `feature` | **Type:** `Feature` `Feature` passed into the `FeatureStyleFunction` for styling. |

## [FeatureStyleOptions](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#FeatureStyleOptions)
interface


interface
`google.maps.FeatureStyleOptions`

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

| ### Properties ||
|---|---|
| `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](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#Feature)
interface


interface
`google.maps.Feature`

extended by `DatasetFeature, PlaceFeature`

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.

| ### Properties ||
|---|---|
| `featureType` | **Type:** `FeatureType` `FeatureType` of this `Feature`. |

## [PlaceFeature](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#PlaceFeature)
interface


interface
`google.maps.PlaceFeature`
extends `Feature`

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.COUNTRY`, `FeatureType.LOCALITY`, `FeatureType.POSTAL_CODE`, and `FeatureType.SCHOOL_DISTRICT`.

| ### Properties ||
|---|---|
| `placeId` | **Type:** `string` The `PlaceResult.place_id`. |

| ### Methods ||
|---|---|
| `fetchPlace` | `fetchPlace()` **Parameters:** None **Return Value:** `Promise<Place>` Fetches a `Place` for this `PlaceFeature`. In the resulting `Place` object, the `id` and the `displayName` properties will be populated. The display name will be in the language the end user sees on the map. (Additional fields can be subsequently requested via `Place.fetchFields()` subject to normal Places API enablement and billing.) Do not call this from a `FeatureStyleFunction` since only synchronous FeatureStyleFunctions are supported. The promise is rejected if there was an error fetching the `Place`. |

## [DatasetFeature](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#DatasetFeature)
interface


interface
`google.maps.DatasetFeature`
extends `Feature`

> [!WARNING]
> **Notice:** Available only in the [v=beta channel](https://developers.google.com/maps/documentation/javascript/versions.md.txt#choosing-the-beta-channel).

An interface representing a feature from a Dataset. The `featureType` of a `DatasetFeature` will always be `FeatureType.DATASET`.

| ### Properties ||
|---|---|
| `datasetAttributes` | **Type:** `Object<string, string>` Key-value mapping of the feature's attributes. |
| `datasetId` | **Type:** `string` Dataset id of the dataset that this feature belongs to. |

## [FeatureMouseEvent](https://developers.google.com/maps/documentation/javascript/reference/data-driven-styling.md.txt#FeatureMouseEvent)
interface


interface
`google.maps.FeatureMouseEvent`
extends `MapMouseEvent`

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

| ### Properties ||
|---|---|
| `features` | **Type:** `Array<Feature>` The `Feature`s at this mouse event. |

| ### Methods ||
|---|---|