[postgis-users] Problem with ST_WITHIN

Luigi Castro Cardeles luigi.cardeles at gmail.com
Mon Sep 21 10:47:23 PDT 2009


Hi list and Martin,

many thanks :D

[]'s
Luigi Castro Cardeles


2009/9/21 Martin Davis <mbdavis at refractions.net>

> Switch the arguments around.
>   ST_covers(A, B) = true iff A covers B
> In other words, ST_covers(LINE, POLYGON) = false, but ST_covers(POLYGON,
> LINE) = true.
>
> In other other words, the order of the arguments for ST_covers should be
> the same as for ST_within, and opposite to ST_contains
>
> Luigi Castro Cardeles wrote:
>
>> Hi list and Martin,
>>
>> If i use st_covers, the query 1 and 2 return's false.
>> After read the blog, i am thinking that covers should return true at that
>> cases.
>> query 1:
>> select ST_covers
>>    (
>>        geomfromtext('LINESTRING(10 18, 30 18)',4326),
>>        geomfromtext('MULTIPOLYGON (((10 18,30 18,30 12,10 12,10
>> 18)))',4326)
>>    )
>>
>> and
>>
>> query 2:
>> select ST_covers
>>    (
>>        geomfromtext('POINT(10 18)',4326),
>>        geomfromtext('MULTIPOLYGON (((10 18,30 18,30 12,10 12,10
>> 18)))',4326)
>>    )
>>
>>
>> select postgis_full_version();
>> "POSTGIS="1.3.6" GEOS="3.1.0-CAPI-1.5.0" PROJ="Rel. 4.6.1, 21 August 2008"
>> USE_STATS"
>> I am using postgres 8.3.7 version and windows vista os.
>>
>> I read the release notes and the bug tracker and don't find any bug that
>> fit the problem.
>>
>> In the meanwhile, i will download the postgres 8.3.8, 8.4.1 and try with
>> newer versions of postgis 1.4.0 etc.
>>
>> Anyone has any clues?
>>
>> very thanks for yout help,
>> Luigi Castro Cardeles
>>
>>
>> 2009/9/21 Martin Davis <mbdavis at refractions.net <mailto:
>> mbdavis at refractions.net>>
>>
>>
>>    The OGC definition for Contains and Within have always seemed a
>>    bit non-intuitive to me.  They may be theoretically elegant. but
>>    they don't really address the most common use case.   (See a blog
>>    post on this as:
>>
>> http://lin-ear-th-inking.blogspot.com/2007/06/subtleties-of-ogc-covers-spatial.html
>> ).
>>
>>    That's why JTS, GEOS and PostGIS define the covers() predicate,
>>    which has simpler, more intuitive and more practical semantics.
>>
>>    http://postgis.refractions.net/documentation/manual-1.4/ST_Covers.html
>>
>>
>>    Luigi Castro Cardeles wrote:
>>
>>        Hi list and Chris,
>>
>>        this is what i was asking :D
>>
>>        i was thinking that boundary is part of the geometry, so if
>>        there is some geometry on the boundary (in this case, a point
>>        on the polygon boundary) then the point is within the polygon.
>>        But after your message i read the specs
>>        (http://portal.opengeospatial.org/files/?artifact_id=18241)
>>        about within, i see the relate and now i understand. Thanks
>>        for the hint Chris.
>>
>>        []'s
>>        Luigi Castro Cardeles
>>
>>
>>        2009/9/18 Chris Hermansen <chris.hermansen at timberline.ca
>>        <mailto:chris.hermansen at timberline.ca>
>>        <mailto:chris.hermansen at timberline.ca
>>        <mailto:chris.hermansen at timberline.ca>>>
>>
>>
>>           If it's on the boundary, is it within?
>>           Chris Hermansen        chris.hermansen at timberline.ca
>>        <mailto:chris.hermansen at timberline.ca>
>>           <mailto:chris.hermansen at timberline.ca
>>        <mailto:chris.hermansen at timberline.ca>>
>>
>>           tel+1.604.714.2878 · fax+1.604.733.0631 · mob+1.778.840.4625
>>           Timberline Natural Resource Group · www.timberline.ca
>>        <http://www.timberline.ca>
>>           <http://www.timberline.ca>
>>
>>           401 · 958 West 8th Avenue  · Vancouver BC · Canada · V5Z 1E5
>>
>>
>>           -----Original Message-----
>>           From: Luigi Castro Cardeles <luigi.cardeles at gmail.com
>>        <mailto:luigi.cardeles at gmail.com>
>>           <mailto:luigi.cardeles at gmail.com
>>        <mailto:luigi.cardeles at gmail.com>>>
>>
>>           Date: Fri, 18 Sep 2009 10:01:32
>>           To: PostGIS Users
>>        Discussion<postgis-users at postgis.refractions.net
>>        <mailto:postgis-users at postgis.refractions.net>
>>           <mailto:postgis-users at postgis.refractions.net
>>        <mailto:postgis-users at postgis.refractions.net>>>
>>           Subject: Re: [postgis-users] Problem with ST_WITHIN
>>
>>
>>           _______________________________________________
>>           postgis-users mailing list
>>           postgis-users at postgis.refractions.net
>>        <mailto:postgis-users at postgis.refractions.net>
>>           <mailto:postgis-users at postgis.refractions.net
>>        <mailto:postgis-users at postgis.refractions.net>>
>>
>>           http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>           _______________________________________________
>>           postgis-users mailing list
>>           postgis-users at postgis.refractions.net
>>        <mailto:postgis-users at postgis.refractions.net>
>>           <mailto:postgis-users at postgis.refractions.net
>>        <mailto:postgis-users at postgis.refractions.net>>
>>
>>           http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>>        _______________________________________________
>>        postgis-users mailing list
>>        postgis-users at postgis.refractions.net
>>        <mailto: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
>>    <mailto:postgis-users at postgis.refractions.net>
>>    http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090921/ebac9f78/attachment.html>


More information about the postgis-users mailing list