Ticket #512 (new enhancement)

Opened 15 months ago

Last modified 15 months ago

Use prepared geometries for relate-pattern tests

Reported by: cdestigter Owned by: strk
Priority: major Milestone: GEOS Future
Component: Core Version: svn-trunk
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

Changed 15 months ago by strk

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.

Changed 15 months ago by cdestigter

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

Changed 15 months ago by cdestigter

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

Note: See TracTickets for help on using tickets.