pointInPolygon
Whether a point lies inside a polygon or multipolygon. Holes are respected:
a point in a hole is outside, and a point inside an island within a hole is
inside. A point on an edge counts as inside unless ignoreBoundary is set.
An empty polygon holds nothing.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { pointInPolygon } from "@mapcairn/core";
function pointInPolygon(point: PointInput, polygon: GeometryInput, options?: PointInPolygonOptions): boolean;
Description
The test is planar, on the longitude and latitude as given, so it is sound for any polygon that does not cross the antimeridian (GeoJSON splits those at 180 degrees, and each piece works).
Parameters
point(PointInput)polygon(GeometryInput)options?(PointInPolygonOptions)
Returns
boolean
Throws
GeometryErrorof kindinvalidfor a malformed point or polygon,unsupportedwhen the shape is not aPolygonorMultiPolygon.