Opened 14 years ago
Last modified 13 years ago
#884 closed defect
Unstable results with Prepared Geometry (ST_Within, ST_Intersects) — at Version 5
Reported by: | strk | Owned by: | pramsey |
---|---|---|---|
Priority: | high | Milestone: | PostGIS 1.5.3 |
Component: | postgis | Version: | 1.5.X |
Keywords: | history | Cc: | lreeder |
Description (last modified by )
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
Change History (5)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Oops wrong output - but still the same result
select gid, ST_IsValid(the_geom), ST_Within(ST_GeomFromText('POINT (-115.04252 36.05137)', -1), the_geom) from foo_reload where gid !=2; gid | st_isvalid | st_within -----+------------+----------- 1 | t | f 3 | t | t
comment:3 by , 14 years ago
I think it has to do with prepared geometries too. You get true where gid > 2 and two falses where gid > 1.
comment:4 by , 14 years ago
Milestone: | PostGIS 2.0.0 → PostGIS 1.5.3 |
---|---|
Version: | trunk → 1.5.X |
Reporter says this bug is in 1.5.2, calling for an 1.5.3 on bugfix here (but not planning to fix this myself, not in the short term at least)
comment:5 by , 14 years ago
Description: | modified (diff) |
---|---|
Summary: | Unstable results from ST_Within → Unstable results with Prepared Geometry (ST_Within, ST_Intersects) |
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
Just to add to strk — me too, and see ST_DWithin works fine and since ST_Within works fine with just one record, and I don't think ST_DWithin uses prepared geometry, that rules out Geos and any weirdness in PostgreSQL. So I'm guessing prepared geometry hashing. Check this out: