@d3-maps/core / feature
feature
Table of contents
Functions
getFeatureKey()
ts
function getFeatureKey(
feature: MapFeatureData,
idKey?: string,
fallback?: string | number): string | number | undefined;Resolves a stable key for a feature.
Checks:
feature[idKey]feature.properties[idKey]- optional fallback value
Parameters
| Parameter | Type | Default value |
|---|---|---|
feature | MapFeatureData | undefined |
idKey | string | 'id' |
fallback? | string | number |
Returns
string | number | undefined
Interfaces
MapFeatureProps
Shared props contract for a single rendered feature.
Extends
MapObjectProps<TStyle>
Type Parameters
| Type Parameter | Default type |
|---|---|
TStyle | unknown |
Properties
| Property | Type | Inherited from |
|---|---|---|
data | MapFeatureData | - |
styles? | Partial<Record<"default" | "hover" |
MapFeaturesProps
Shared props contract for feature collections rendered from the current map context.
Extends
Omit<MapFeatureProps<TStyle>,"data">
Type Parameters
| Type Parameter | Default type |
|---|---|
TStyle | unknown |
Properties
| Property | Type | Inherited from |
|---|---|---|
idKey? | string | - |
styles? | Partial<Record<"default" | "hover" |
Type Aliases
MapFeatureData
ts
type MapFeatureData = 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).