[postgis-users] Point on a surface doesn`t touch geometry?

Paul Ramsey pramsey at opengeo.org
Wed Apr 29 07:45:57 PDT 2009


Don't use ST_Buffer() for predicate (true/false) testing, use ST_DWithin().

This is heinously inefficient ST_Overlaps(geoma, ST_Buffer(geomb,1.0))
This is ludicrously more efficient ST_DWithin(geoma, geomb, 1.0)

P.

On Wed, Apr 29, 2009 at 4:26 AM, Kai Behncke <Kai-Behncke at gmx.de> wrote:
> Dear Martin, Regina, Niloas,
>
> thank you very much for your answers :-)
>
> Meanwhile I solved the problem using:
>
>
> SELECT overlaps (the_geom,buffer(Geomfromtext('POINT(897169.996155569
>  6850066.73917209)',900913),1)) from ways where gid=14730;
>
> Then I get "TRUE".
>
>
> Best regards, Kai
>
>
> -------- Original-Nachricht --------
>> Datum: Tue, 28 Apr 2009 08:28:42 -0700
>> Von: Martin Davis <mbdavis at refractions.net>
>> An: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>> Betreff: Re: [postgis-users] Point on a surface doesn`t touch geometry?
>
>> Also, the point probably doesn't lie *exactly* on the geometry due to
>> roundoff error.
>>
>> It's correct that Overlaps returns FALSE, since an interior point does
>> not overlap its containing geometry.  Intersects should have returned
>> TRUE however - IF the point was precisely on a line segment.  This is
>> unlikely to happen in the general case.
>>
>> Nicolas Ribot wrote:
>> >> Dear users,
>> >>
>> >>
>> >> with "SELECT astext(pointOnSurface(the_geom)) from ways where
>> gid=14730"
>> >> I get the coordinates of a point that lies on the surface of a
>> MULTILINESTRING.
>> >>
>> >> I get: POINT(897169.996155569 6850066.73917209)
>> >>
>> >> Then I try
>> >> SELECT overlaps (the_geom,Geomfromtext('POINT(897169.996155569
>> 6850066.73917209)',900913)) from ways where gid=14730;
>> >>
>> >> ...and I get FALSE ???
>> >>
>> >> (I also tried with "touches" and "intersects" --> the
>> >> result there also FALSE).
>> >>
>> >>
>> >> Has anybody an idea how this can be?
>> >>
>> >>
>> >
>> > Hi Kai,
>> > Yes, this can be because of the OGC specifications, that define very
>> > precisely these predicates, in terms of relationship between interior,
>> > boundary and exterior of each object.
>> > A point cannot overlap a polygon, for instance (as far as I remember)
>> > Looking at the predicates definitions in the specifications may help
>> > to understand what they mean, for each kind of objects (points, lines,
>> > polygons):
>> >
>> > http://www.opengeospatial.org/standards/sfs
>> >
>> > (don't trust your 'human' understanding of what 'touches' or 'overlaps'
>> mean)
>> >
>> > You may also look at the Jump documentation, as it contains nice
>> > graphics showing some common misunderstandings with these predicates
>> > (http://www.vividsolutions.com/JUMP/)
>> >
>> > HTH
>> > Nicolas
>> > _______________________________________________
>> > postgis-users mailing list
>> > postgis-users at postgis.refractions.net
>> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>> >
>> >
>>
>> --
>> Martin Davis
>> Senior Technical Architect
>> Refractions Research, Inc.
>> (250) 383-3022
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
> _______________________________________________
> 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