Expand description
2i: PostGIS-geography math, ported from e1 (already calibrated equal to PostGIS to float precision there). Distances = Vincenty’s inverse formula on the WGS84 ellipsoid, in METRES; areas = spherical excess on the authalic sphere, in SQUARE METRES; point-in-polygon = planar even-odd crossing in coordinate space (the named subset deviation: correct away from poles/antimeridian; geography-PostGIS itself offers ST_Covers for the sphere-true predicate). Functions take (lat, lon) – PostGIS textual order; GeoJSON stores [lon, lat] and converters own the flip. Rings use the internal [[lat, lon], …] layout.
Functions§
- geodesic_
distance_ m - Geodesic distance between two points in METRES on the WGS84 ellipsoid
(Vincenty inverse). Matches PostGIS
ST_Distance(a::geography, b::geography). - geodesic_
path_ length_ m - Geodesic length of a
[lat, lon]vertex path in METRES (sum of Vincenty edges). For a closed ring this is the perimeter. Matches PostGISST_Perimeter/ST_Length. - geodesic_
ring_ area_ m2 - Geodesic area of a polygon ring (
[lat, lon]) in SQUARE METRES, via the spherical excess on the WGS84 authalic sphere. Matches PostGISST_Area(::geography)to ~1e-5 relative for city-scale polygons. Sign is dropped (absolute area); the ring need not be explicitly closed. - haversine_
km - Great-circle (sphere) distance in KILOMETRES – the cheap pre-filter: diverges from Vincenty/WGS84 by < 0.56%, so any comparison further than that band from a threshold can be decided here without the iterative formula.
- point_
in_ polygon - Test whether a point is inside a polygon ring using the ray-casting algorithm.