sqrDistanceToRing

open fun sqrDistanceToRing(pntX: Double, pntY: Double, @Nullable ring: Array<Array<Double>>): Double

Squared distance from a point to a polygon ring, expressed in this ruler's units (meters by default). Walks every segment between adjacent ring vertices and returns the smallest squared distance. Coordinates are in degrees ([lng, lat]) and are scaled internally using the ruler's reference latitude before the segment-projection math, so the returned value is a proper squared real-world distance.

Returns POSITIVE_INFINITY when ring is null or has fewer than two vertices, so callers can fold this across multiple rings with min without a special-case.

Return

smallest squared distance to any segment of ring in this ruler's units²

Parameters

pntX

point longitude (degrees)

pntY

point latitude (degrees)

ring

polygon ring vertices as [[lng, lat], ...]