[postgis-users] Problems with ST_Within in an island of a multipolygon

Larry Reeder lnreeder at gmail.com
Fri Mar 25 09:41:10 PDT 2011


FYI, I verified I can reproduce this behavior in PostGIS 1.5.2:

#  SELECT postgis_full_version();
                                         postgis_full_version
-------------------------------------------------------------------------------------------------------
 POSTGIS="1.5.2" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.7.1, 23
September 2009" LIBXML="2.7.7" USE_STATS


On Fri, Mar 25, 2011 at 10:11 AM, Larry Reeder <lnreeder at gmail.com> wrote:
> Thanks for the response, Sandro.    I've posted a test case on Dropbox
> at http://dl.dropbox.com/u/14591732/foo_reload.sql.   This SQL script
> will create a table called "foo_reload" with three features.   Here's
> my sample session:
>
> #  \i /tmp/foo_reload.sql
> [load statements removed]
>
> #  select gid, ST_IsValid(the_geom) from foo_reload;
>  gid | st_isvalid
> -----+------------
>   1 | t
>   2 | t
>   3 | t
> (3 rows)
>
> So, all 3 features are valid.   Good.
>
> #  select ST_Within(ST_GeomFromText('POINT (-115.04252 36.05137)',
> -1), the_geom) from foo_reload where gid = 3;
>  st_within
> -----------
>  t
> (1 row)
>
> Feature #3 contains my test point.   Good.
>
> #  SELECT gid from foo_reload where ST_Within(ST_GeomFromText('POINT
> (-115.04252 36.05137)', -1), the_geom);
>  gid
> -----
> (0 rows)
>
> No features contain my test point.  What????
>
> # delete from foo_reload where gid = 2;
> DELETE 1
>
> Deleted feature #2 from my layer.  This is the "water" that surrounds
> my multipolygon "island".
>
> # SELECT gid from foo_reload where ST_Within(ST_GeomFromText('POINT
> (-115.04252 36.05137)', -1), the_geom);
>  gid
> -----
>   3
> (1 row)
>
> Now PostGIS tells me that feature #3 contains the point.  What??
>
>
> Can anyone else reproduce my problem?
>
>
> Thanks..............              Larry
>
>
>
> On Wed, Mar 23, 2011 at 3:23 PM, Sandro Santilli <strk at keybit.net> wrote:
>> On Tue, Mar 22, 2011 at 07:17:26AM -0600, Larry Reeder wrote:
>>> Anybody have any ideas on this one?    Do you think I should post it
>>> to the developer list?
>>
>> You might post a testcase, the smallest possible.
>>
>> --strk;
>>
>>  ()   Free GIS & Flash consultant/developer
>>  /\   http://strk.keybit.net/services.html
>> _______________________________________________
>> 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