@d3-maps/core / feature
feature
Table of contents
Functions
getFeatureKey()
ts
function getFeatureKey(
feature: MapFeature,
idKey?: string,
index: number): string | number;Resolves a stable key for a feature.
Checks:
feature[idKey]feature.properties[idKey]- fallback to the list index
Parameters
| Parameter | Type | Default value |
|---|---|---|
feature | MapFeature | undefined |
idKey | string | 'id' |
index | number | undefined |
Returns
string | number
Interfaces
MapFeatureProps
Shared props contract for a single rendered feature.
Type Parameters
| Type Parameter | Default type |
|---|---|
TStyle | unknown |
Properties
| Property | Type |
|---|---|
data | MapFeature |
styles? | Partial<Record<"default" |
Type Aliases
MapFeature
ts
type MapFeature = ExtendedFeature & Record<string, unknown> | ExtendedFeature;A GeoJSON Feature used by d3-maps.
This type allows extra top-level fields to be attached in dataTransformer (e.g. choropleth colors).