ClearSKY FaviconClearSKY Polygon Tools
Back to Glossary

Point-in-polygon (PIP)

A test that checks whether a point lies inside a polygon (often used for geofencing and joins).

Category: Topology · Also known as: point in polygon, PIP test, point-in-polygon

Definition (expanded)

Point-in-polygon (PIP) is the classic spatial test: is point P inside polygon A? Details matter: points on the boundary may be treated differently depending on the predicate (Contains vs Covers) and how holes are represented.

Examples

PIP in PostGIS (contains)

Coordinates are lon, lat when using EPSG:4326.

SQL

SELECT ST_Contains(ST_GeomFromText('POLYGON((12 55, 12.2 55, 12.2 55.2, 12 55.2, 12 55))', 4326), ST_Point(12.1, 55.1));

Common mistakes