Inside the outline, outside the area: GeoJSON polygon holes
The point is clearly inside the outer outline, yet a spatial filter leaves it out. Before moving the point or deleting part of the geometry, inspect the polygon’s inner rings. A GeoJSON Polygon can describe an area with holes: space enclosed by the outside boundary that does not belong to the polygon’s interior.
This becomes consequential when a report says that all records inside a drawn outline were included. The outline alone is not the full selection rule. You also need the holes and a decision about points exactly on a boundary.

Read the nesting before counting areas
In a GeoJSON Polygon, the first coordinate ring defines the outside boundary; subsequent rings define holes. Those later rings are not automatically extra included districts. A MultiPolygon has another level of nesting for separate polygons. RFC 7946, section 3.1.6 defines these roles.
A ring closes by repeating its starting position. The standard specifies counterclockwise exterior rings and clockwise holes, while advising parsers not to reject older data solely for the opposite winding. Do not treat reversing a ring as a reliable way to change an excluded patch into included space. Its position in the Polygon structure matters.
A fictional zone with four check points
The following invented geometry is training data. It does not identify a real service area, property or event. Save it as zone.geojson. Coordinates follow GeoJSON’s longitude, latitude order, in decimal degrees.
{
"type": "Polygon",
"coordinates": [
[[12,40],[12.06,40],[12.06,40.06],[12,40.06],[12,40]],
[[12.02,40.02],[12.02,40.04],[12.04,40.04],
[12.04,40.02],[12.02,40.02]]
]
}
The outside rectangle runs from longitude 12 to 12.06 and latitude 40 to 40.06. A smaller rectangle, from 12.02 to 12.04 and 40.02 to 40.04, is a hole. Notice that this smaller ring travels in the opposite direction. Both repeat their first position at the end.
| Point ID | Longitude, latitude | Position in the exercise | contains | covers |
|---|---|---|---|---|
| desk-a | 12.01, 40.03 | Inside the included area | True | True |
| desk-b | 12.03, 40.03 | Inside the hole | False | False |
| desk-c | 12.02, 40.03 | On the hole’s boundary | False | True |
| desk-d | 12.08, 40.03 | Beyond the outside boundary | False | False |
We created this geometry locally and checked it with Shapely 2.1.2, GEOS 3.13.1 and Python 3.12.10. Its validity check passed, and the point results matched the table. This was a synthetic planar geometry test, not a live-map check or verification of any real location.
Boundary inclusion is a separate choice
For these point tests, Shapely’s contains excludes boundary points. covers includes them. That includes the boundary around a hole; it does not fill in the hole’s interior. The contrast between desk-b and desk-c makes the distinction visible.
Thus this example retains only desk-a under contains, but retains desk-a and desk-c under covers. Neither output should be described simply as “the inside points” without naming the rule. Keep the retained IDs beside the count.
To reproduce the result with Shapely installed, run this against the saved teaching file:
import json
from shapely.geometry import shape, Point
with open("zone.geojson", encoding="utf-8") as f:
zone = shape(json.load(f))
if not zone.is_valid:
raise ValueError("Review invalid geometry before selection")
points = {
"desk-a": (12.01, 40.03),
"desk-b": (12.03, 40.03),
"desk-c": (12.02, 40.03),
"desk-d": (12.08, 40.03),
}
for key, xy in points.items():
point = Point(xy)
print(key, zone.contains(point), zone.covers(point))
Make the selection answer the actual question
Choose the boundary rule from the task or the dataset’s documented policy, before looking at which result is more convenient. A dataset may describe an exclusion zone, a coverage area or an administrative shape; geometry alone does not establish eligibility, ownership or where an event happened.
For supplied data, confirm the coordinate order and reference system first. The coordinate-format check helps with that step. A bounding rectangle can help find candidate points, but it cannot stand in for a polygon with holes. A rectangle crossing the date line has its own antimeridian selection problem.
If the geometry is invalid, stop and inspect the source. Automatically repairing it can change the shape you are claiming to have examined. Preserve the original and document any repaired derivative and resulting ID changes. The Shapely manual also explains its planar model: these tests are not distance or area measurements in metres. A near-boundary point with uncertain coordinates needs an uncertainty note, not extra decimal places.
Finish with a compact selection receipt: source file/version, feature ID, full geometry including holes, point IDs and raw coordinates, software/version, predicate, validity result and separate boundary cases. For this exercise, one point is strictly inside; a second is included only by the boundary-inclusive rule. Use the report template to attach that rule to the quoted count so another reader can reproduce the same selection.
Author: OSINT Jet · Primary sources reviewed 30 November 2026
