Opened 12 years ago
Last modified 6 years ago
#512 new enhancement
Use prepared geometries for relate-pattern tests
Reported by: | cdestigter | Owned by: | strk |
---|---|---|---|
Priority: | major | Milestone: | GEOS Fund Me |
Component: | Core | Version: | main |
Severity: | Feature Request | Keywords: | |
Cc: |
Description
We recently changed a postgis query from ST_Intersects(a, b) to ST_Relate(a, b, 'T') and were surprised to note a massive performance decrease for large geometries.
Turns out GEOS (and JTS) don't yet support using prepared geometries for the relate-pattern predicate.
Is this hard to add? Does the fact that it's not in JTS preclude it from being added to GEOS?
If not, I'd consider writing a patch, but I could use some direction since this would be my first significant contribution to GEOS.
Change History (4)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
To clarify, ST_Intersects/_ST_Intersects doesn't do what we want (it returns true for geometries whose boundaries overlap but whose interiors don't, which is unsuitable for our use-case)
So we need to use either ST_Relate or some combination of the prepared-geometry functions. I think this would do what we want:
ST_Intersects(a, b) AND NOT ST_Touches(a, b)
... which might be adequate. I'll take another look at the exact problem tonight and perhaps post to geos-devel if it looks vaguely worth doing
comment:3 by , 12 years ago
I did some testing and decided to use ST_Intersects(a, b) AND NOT ST_Touches(a, b)
for now instead, since it performs pretty well and I haven't really got the time to add this to GEOS myself
Consider that ST_Intersects map to using && _and_ then calling _ST_Intersects, which in turn may use prepared geometries and use short-circuiting.
If you want to try prepared geometries for relate patterns anyway please consider discussing this with Martin Davis first. He's on geos-devel mailing list too, if you want to start a thread with your ideas about it.