Skip to content

KBE3D / KBCore / turf / pointToPolygonDistance

函数: pointToPolygonDistance()

pointToPolygonDistance(point: Point | Position | Feature<Point, GeoJsonProperties>, polygonOrMultiPolygon: Polygon | MultiPolygon | Feature<Polygon | MultiPolygon, GeoJsonProperties>, options?: { units?: Units; method?: "geodesic" | "planar"; }): number

Calculates the distance from a point to the edges of a polygon or multi-polygon. Returns negative values for points inside the polygon. Handles polygons with holes and multi-polygons. A hole is treated as the exterior of the polygon.

参数

point

Input point

Point | Position | Feature<Point, GeoJsonProperties>

polygonOrMultiPolygon

Input polygon or multipolygon

Polygon | MultiPolygon | Feature<Polygon | MultiPolygon, GeoJsonProperties>

options?

Optional parameters

units?

Units

Units of the result e.g. "kilometers", "miles", "meters"

method?

"geodesic" | "planar"

Method of the result

返回

number

Distance in meters (negative values for points inside the polygon)

抛出

If input geometries are invalid

KBE3D @3.0.0 Copyright © 2024-present KBE3D