[postgis-devel] [PostGIS] #884: Unstable results with Prepared Geometry (ST_Within, ST_Intersects) (was: Unstable results from ST_Within)

PostGIS trac at osgeo.org
Fri Mar 25 12:20:50 PDT 2011


#884: Unstable results with Prepared Geometry (ST_Within, ST_Intersects)
---------------------+------------------------------------------------------
 Reporter:  strk     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  high     |   Milestone:  PostGIS 1.5.3
Component:  postgis  |     Version:  1.5.X        
 Keywords:           |  
---------------------+------------------------------------------------------

Old description:

> This is pretty puzzling.
> Load attached dataset, then:
>
> {{{
> -- This query says none of the 3 polygons contain the point
> =# select gid, ST_Within(
> ST_GeomFromText('POINT (-115.04252 36.05137)', -1), the_geom
> ) from foo_reload;
>
> -- This query says polygon 3 does contain the point
> =# select gid, ST_Within(
> ST_GeomFromText('POINT (-115.04252 36.05137)', -1), the_geom
> ) from foo_reload where gid = 3;
>
> }}}
>
> Storing the point geometry into a table makes no difference.
> Geometry number 3 really contains the point. The other two don't.
>
> I've tested this with PostgreSQL 8.4.3, PostGIS 2.0.0SVN and GEOS
> 3.3.0dev

New description:

 This is pretty puzzling.
 Load attached dataset, then: (I suspect it affects all functions that used
 prepared geometry - does same with ST_Intersects)

 {{{
 -- This query says none of the 3 polygons contain the point
 =# select gid, ST_Within(
 ST_GeomFromText('POINT (-115.04252 36.05137)', -1), the_geom
 ) from foo_reload;

 -- This query says polygon 3 does contain the point
 =# select gid, ST_Within(
 ST_GeomFromText('POINT (-115.04252 36.05137)', -1), the_geom
 ) from foo_reload where gid = 3;

 }}}

 Storing the point geometry into a table makes no difference.
 Geometry number 3 really contains the point. The other two don't.

 I've tested this with PostgreSQL 8.4.3, PostGIS 2.0.0SVN and GEOS 3.3.0dev

--

Comment(by robe):

 I think this highly points the finger at prepared geometry

 {{{
 select gid, ST_IsValid(the_geom), ST_Intersects(ST_GeomFromText('POINT
 (-115.04252 36.05137)',  -1), the_geom) from foo_reload;

  gid | st_isvalid | st_intersects
 -----+------------+---------------
    1 | t          | f
    2 | t          | f
    3 | t          | f
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/884#comment:5>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list