[postgis-users] relationship functions not working well

Paul Ramsey pramsey at cleverelephant.ca
Fri Dec 5 11:02:02 PST 2008


add

wkb_geometry && SetSRID('BOX3D(-162 55,-161 56)'::box3d,4326)

to your where clause to engage the index.

P

On Fri, Dec 5, 2008 at 10:26 AM, William Kyngesburye
<woklist at kyngchaos.com> wrote:
> 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
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list