# [postgis-users] Re: truly_inside

Chris Hodgson chodgson at refractions.net
Mon Oct 21 10:13:59 PDT 2002

```Yes, distance will be very slow, at least on polylines and polygons, as the
two edges which are nearest eachother on the two polygons must first be
found, then the distance between them calculated. To speed it up some, use

SELECT count(*) t0,t1 WHERE t0.wkb_geomtry && t1.wkb_geometry AND
distance(t0.wkb_geomtry, t1.wkb_geometry)= 0 AND (t0.nombre = 'Galvarino')

This way it can use the index on the && bounding box overlap check.

Chris

----- Original Message -----
From: "Juanse" <georef at tie.cl>
To: <postgis-users at postgis.refractions.net>
Sent: Monday, October 21, 2002 10:05 AM
Subject: RE: [postgis-users] Re: truly_inside

> Paul
>
> Is the distance() method too slow, i am runnig
>
> select count(*) t0,t1 where distance(t0.wkb_geomtry, t1.wkb_geometry)= 0
and
> (t0.nombre = 'Galvarino')
>
> and it takes for ages
>
> t0 have 31 records
> t1 have 1321 records
>
> Juanse
> temuko-chile
>
> ----- Original Message -----
> From: Paul Ramsey <pramsey at refractions.net>
> To: Juanse <georef at tie.cl>
> Cc: <postgis-users at postgis.refractions.net>
> Sent: Monday, October 21, 2002 1:03 PM
> Subject: [postgis-users] Re: truly_inside
>
>
> > Yes and no. The full Relate() method is still under construction (but
> > quite quite close).
> >
> > You can test overlaps/touchs indirectly though, using the Distance()
> > function, which is good enough for the purpose. A Distance() = 0 implies
> > that the objects either touch, overlap, or contain; ie, they share some
> > part of their area.
> >
> > P.
> >
> > Juanse wrote:
> > > Paul
> > >
> > > on january 2002 this fellow ask for the question of "a way to check
> > > whether polygon A intersects/ (overlaps) with polygon B? Both polygons
> > > can have arbitrary shapes.
> > > /
> > > you answer that it was in the To Do list
> > >
>
http://postgis.refractions.net/pipermail/postgis-users/2002-January/000567.h
> tml
> > >
> > >
> > > Is it already implemented?
> > >
> > > Juanse
> > > temuko-chile
> > >
> > >
> > >
> > >
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.401 / Virus Database: 226 - Release Date: 10/10/02
> >
> >
> > --
> >        __
> >       /
> >       | Paul Ramsey
> >       | Refractions Research
> >       | Email: pramsey at refractions.net
> >       | Phone: (250) 885-0632
> >       \_
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.401 / Virus Database: 226 - Release Date: 10/10/02
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>

```