[postgis-users] relationship functions not working well
William Kyngesburye
woklist at kyngchaos.com
Fri Dec 5 10:26:12 PST 2008
On Dec 5, 2008, at 11:22 AM, Martin Davis wrote:
> Good news! I thought about this some more overnight, and I realized
> that the relation "interior-intersects" should produce the result
> you're looking for. This still doesn't have a named predicate, but
> the really good news is that the IM pattern for this is trivial:
> [T********] .
>
> (Exercise left for the student: Prove that the pattern expression
> for "intersects-and-not-touches" is equivalent to [T********]. Or
> not - the proof in either situation would be interesting)
Well, that works:
ST_relate(wkb_geometry, SetSRID('BOX3D(-162 55,-161 56)'::box3d,4326),
'T********')
But it's painfully slow - looks like relate doesn't do an index
bounding box test.
... added a normal intersect (it's a superset of what I want) and let
short-circuit logic take care of the initial selection:
ST_Intersects(wkb_geometry, SetSRID('BOX3D(-162 55,-161 56)'::box3d,
4326)) AND ST_relate(wkb_geometry, SetSRID('BOX3D(-162 55,-161
56)'::box3d,4326), 'T********')
That's reasonably fast, for a small box at least. It will likely slow
down on a larger box.
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
"Those people who most want to rule people are, ipso-facto, those
least suited to do it."
- A rule of the universe, from the HitchHiker's Guide to the Galaxy
More information about the postgis-users
mailing list