Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#3729 closed defect (invalid)

ST_Intersects works incorrect for simple MULTIPOLYGON

Reported by: biog Owned by: pramsey
Priority: medium Milestone: PostGIS 2.3.3
Component: postgis Version: 2.3.x
Keywords: Cc:

Description

I got strange result for ST_Intersects function

SELECT ST_Intersects( ST_GeographyFromText('SRID=4326;MULTIPOLYGON(((-131.66015625 50.7121128961851,-131.30859375 23.2060096376488,-59.58984375 22.8825014343701,-60.64453125 51.1552316115623,-131.66015625 50.7121128961851)))'), ST_GeographyFromText('SRID=4326;POINT(-80.265919 26.068188)'));
 st_intersects
---------------
 f
(1 row)

I'm 100% sure that point intersects multipolygon.

It works as expected for geometry type:

SELECT ST_Intersects( ST_GeomFromText('MULTIPOLYGON(((-131.66015625 50.7121128961851,-131.30859375 23.2060096376488,-59.58984375 22.8825014343701,-60.64453125 51.1552316115623,-131.66015625 50.7121128961851)))', 4326), ST_GeomFromText('POINT(-80.265919 26.068188)', 4326));
 st_intersects
---------------
 t
(1 row)

I use latest PostgreSQL 9.6.2 on Debian Jessie.

SELECT PostGIS_full_version();
                                                                         postgis_full_version
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.3.2 r15302" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="0.11.99" RASTER
(1 row)

Change History (3)

comment:1 Changed 3 years ago by pramsey

Resolution: invalid
Status: newclosed

You think your polygon looks like this http://bl.ocks.org/anonymous/raw/fc32d1d65d6888fc8b59bd902aae8b6c/

But it doesn't, it looks like this, in geography space http://bl.ocks.org/anonymous/raw/4b097ab24af7b224dcfdaafc2cb5c3d3/

comment:2 Changed 3 years ago by pramsey

Here's one w/ your point on it too. http://bl.ocks.org/d/8d4eebd54f60495dde3d185e4d3fa9c1

comment:3 Changed 3 years ago by biog

Thanks pramsey, you are right! Now I understand why this point doesn't intersect polygon. It seems I have to change my data type from geography to geometry.

Note: See TracTickets for help on using tickets.