Repository navigation
Align point containment with OGC/PostGIS semantics - #266
Merged
Merged
Conversation
Point containment on Ring, Polygon, MultiPolygon, GeometryCollection, Feature and FeatureCollection now follows OGC/PostGIS naming: - contains(_:) is interior-only (ST_Contains) - covers(_:) includes the boundary (ST_Covers) - locate(_:) returns .interior/.boundary/.exterior (JTS/GEOS Location) Remove the ignoringBoundary parameter and update all internal call sites to state their intent explicitly. A point on a hole boundary is now classified as .boundary, matching JTS SimplePointInAreaLocator and fixing the inverted hole-boundary behaviour (#257). Add CHANGELOG.md documenting the breaking API changes and the migration mapping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns point containment with OGC Simple Features / PostGIS naming, fixing the hole-boundary inversion from #257. Turf was only the porting reference; OGC/PostGIS is now the semantic reference.
New API
Available on
Ring,Polygon,MultiPolygon,GeometryCollection,FeatureandFeatureCollection, for bothCoordinate3DandPoint:contains(_:)ST_Contains: interior onlycovers(_:)ST_Covers: interior or boundarylocate(_:)Locationcontains(_:ignoringBoundary:gridSize:)is removed.gridSize:remains on all three methods.Hole semantics
Polygon.locatenow mirrors JTSSimplePointInAreaLocator:.exterior.boundary.boundary(previously treated as outside the polygon or inside the hole depending on the flag).exterior.interiorChanges
ignoringBoundarycall sites migrated explicitly:true→contains,false→covers. This preserves the intended behaviour in touches, difference, union, intersection, symmetric difference, overlay, mask, collect, disjoint, crosses, polygonize andPointsWithinPolygon.PolygonGeometryprotocol requirements updated tolocate/contains/covers.CHANGELOG.mdadded with the breaking-change section and migration table.Tests
locate.Feature,FeatureCollection,MultiPolygonand nestedGeometryCollectioncoverage.containsincluded the boundary.Follow-up
Geometry-level
GeoJson.contains(_:)/covers(_:)for line and polygon operands still use boundary-inclusive vertex checks. The interior-only split with segment-aware coverage is the next step, as noted inCHANGELOG.mdand the doc comments.Fixes #257