[postgis-tickets] [PostGIS] #4727: polygon and point intersection calculated wrong for huge polygon

PostGIS trac at osgeo.org
Wed Jul 22 08:47:02 PDT 2020


#4727: polygon and point intersection calculated wrong for huge polygon
------------------------+---------------------------
 Reporter:  prytvinsky  |      Owner:  pramsey
     Type:  defect      |     Status:  new
 Priority:  medium      |  Milestone:  PostGIS 3.1.0
Component:  postgis     |    Version:  3.0.x
 Keywords:              |
------------------------+---------------------------
 postgis version:
 POSTGIS="3.0.1 ec2a9aa" [EXTENSION] PGSQL="120" GEOS="3.8.1-CAPI-1.13.3"
 PROJ="7.1.0" LIBXML="2.9.10" LIBJSON="0.14" LIBPROTOBUF="1.3.3"
 WAGYU="0.4.3 (Internal)" TOPOLOGY

 sql query example:

 {{{
 create table geometry_real_shape as (
 select
     _ST_DWithinUncached(
                 ST_Split(geom, 'SRID=4326;LINESTRING(-180 0, 180
 0)')::geography,
                 ST_MakePoint(x,y)::geography,
                 0
         ) =
         ST_Dwithin(geom::geography, ST_MakePoint(x,y), 0
         ) as passed,
         _ST_DWithinUncached(
                 ST_Split(geom, 'SRID=4326;LINESTRING(-180 0, 180
 0)')::geography,
                 ST_MakePoint(x,y)::geography,
                 0
         ) as expected,
         ST_Dwithin(geom::geography, ST_MakePoint(x,y), 0) as actual,
         x,
         y,
         ST_MakePoint(x,y)::geography as geom
 from
         (select'SRID=4326;POLYGON ((-180 -85.05112877980659, -180
 74.99999999999997, -152 80, -130 84.99999999999997, -115
 85.05112877980659, -60 85.05112877980659, -60 79, -70 70, -130 50, -80 6,
 -65 -53, -100 -85.05112877980659, -180 -85.05112877980659))'::geometry as
 geom) as z,
         generate_series(-180,180) x, generate_series(-90,90) y
     );
 }}}

 in this query same result expected for "_ST_DWithinUncached" and
 "ST_Dwithin"

 The difference is for "_ST_DWithinUncached" polygon is splitted by equator
 and intersection is correct.

 When i use ST_Dwithin the intersection is wrong.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4727>
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-tickets mailing list