distance

open fun distance(@NonNull geoJson: GeoJson): Expression

Retrieves the shortest distance between two geometries. The returned value can be consumed as an input into another expression for changing a paint or layout property or filtering features by distance.

Currently supports `Point`, `MultiPoint`, `LineString`, `MultiLineString` geometry types.

Return

the distance in the unit "meters".

Parameters

geoJson

the target feature geoJson. Currently supports `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon` geometry types

See also

<a href="https://maplibre.org/maplibre-style-spec/expressions/#distance">Style specification</a>