Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3708 closed defect (wontfix)

within function gives wrong results

Reported by: gisdev1982 Owned by: pramsey
Priority: high Milestone: PostGIS PostgreSQL
Component: postgis Version: 1.5.X
Keywords: Cc:

Description

Hi Team, While executing the following query it gives wrong results. This was tested in postgis version from 1.2.1 to 1.5.5. In all the versions it gives wrong results.

Query is: SELECT within(geomfromtext('POLYGON((61 34,66 34,66 31,61 31,61 34))',101), geomfromtext('POLYGON((62 48,83 48,83 29,55 29,55 33,62 48))',101))

It gives me 'f' as result where as it should be 't'

If I execute the same query by adding some precision as shown below it gives me correct result.

SELECT within(geomfromtext('POLYGON((61 34,66.0000001 34,66 31,61 31,61 34))',101), geomfromtext('POLYGON((62 48,83 48,83 29,55 29,55 33,62 48))',101))

kindly help me how I can get the correct result without adding the precision.

Change History (2)

comment:1 by robe, 8 years ago

Resolution: wontfix
Status: newclosed

I tested this on PostGIS 2.3 running GEOS 3.6.1 and it works fine.

POSTGIS="2.3.2 r15302" GEOS="3.6.1-CAPI-1.10.1 r4317" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.1.3, released 2017/20/01" LIBXML="2.7.8" LIBJSON="0.12" RASTER
SELECT ST_Within(st_geomfromtext('POLYGON((61 34,66 34,66 31,61 31,61 34))',101), st_geomfromtext('POLYGON((62 48,83 48,83 29,55 29,55 33,62 48))',101));

st_within


t

(1 row)

Which version of GEOS are you running? I suspect upgrading your GEOS might do the trick.

Two reasons why we won't fix this:

1) It's likely this is a GEOS bug, not a PostGIS bug

2) PostGIS 1.5, we at best make only security patches on a version that old.

Last edited 8 years ago by robe (previous) (diff)

comment:2 by robe, 8 years ago

More information. I happen to have a PostGIS 1.5.5 lying around and get true on that:

SELECT postgis_full_version();

POSTGIS="1.5.5" GEOS="3.3.8-CAPI-1.7.8" PROJ="Rel. 4.6.1, 21 August 2008" LIBXML="2.7.8" 
SELECT ST_Within(st_geomfromtext('POLYGON((61 34,66 34,66 31,61 31,61 34))',101), st_geomfromtext('POLYGON((62 48,83 48,83 29,55 29,55 33,62 48))',101));

st_within
----------
t

So seems your problem might be with GEOS. Upgrade your GEOS and see if it fixes your issue.

Note: See TracTickets for help on using tickets.