Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use spatial index to check shell nesting in IsValidOp #256

Merged
merged 2 commits into from
Dec 13, 2019

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Dec 6, 2019

This PR introduces an IndexedNestedShellTester class, modelled after
IndexedNestedRingTester, to check shell nesting as part of MultiPolygon
validity checking. Relevant methods are yanked out of IsValidOp
then updated to use indexes to locate rings relative to each other
(STRtree) and to check point containment within a ring
(IndexedPointOnAreaLocator).

You need the right geometry for this to matter.

This commit reduces GEOSisValid runtime for a test geometry (GADM
boundary of Australia) from about 85 seconds to less than 1 second
. It
does not appreciably change runtime for TIGER counties, HydroBASINS
Level 5, or a sample parcel dataset.

This commit introduces a IndexedNestedShellTester class, modelled after
IndexedNestedRingTester, to check shell nesting as part of MultiPolygon
validity checking. Indexes are used both to locate rings relative to
each other (STRtree) and to check point containment within a ring
(IndexedPointOnAreaLocator).

This commit reduces GEOSisValid runtime for a test geometry (GADM
boundary of Australia) from about 85 seconds to less than 1 second. It
does not appreciably change runtime for TIGER counties, HydroBASINS
Level 5, or a sample parcel dataset.
@dr-jts
Copy link
Contributor

dr-jts commented Dec 6, 2019

Wow, nice performance bump.

This is relevant to MultiPolygons with large numbers of element Polygons, right?

@dbaston
Copy link
Member Author

dbaston commented Dec 8, 2019

This is relevant to MultiPolygons with large numbers of element Polygons, right?

Yes. Australia sees such a huge benefit because it has so many islands that have to be tested against the highly-complex shell for the mainland.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants