[postgis-devel] [PostGIS] #503: ST_Area on small polygons in EPSG:31467 gives incorrect results depending on 32-/64-system-architecture

PostGIS trac at osgeo.org
Thu Apr 15 07:27:04 PDT 2010


#503: ST_Area on small polygons in EPSG:31467 gives incorrect results depending
on 32-/64-system-architecture
----------------------+-----------------------------------------------------
  Reporter:  mjansen  |       Owner:  pramsey      
      Type:  defect   |      Status:  new          
  Priority:  medium   |   Milestone:  PostGIS 1.5.2
 Component:  postgis  |     Version:  1.5.X        
Resolution:           |    Keywords:               
----------------------+-----------------------------------------------------
Comment (by pramsey):

 {{{
 postgis15=# select st_area('POLYGON ((3498246.2563 5815493.2389,
 3498246.2472 5815493.1259, 3498246.2094 5815493.1202, 3498246.2563
 5815493.2389))');
    st_area
 -------------
  0.001953125
 (1 row)

 postgis15=# select st_area('POLYGON ((3498246.2563 5815493.2389,
 3498246.2472 5815493.1259, 3498246.2094 5815493.1202, 3498246.2294
 5815493.1802,  3498246.2563 5815493.2389))');
  st_area
 ---------
        0
 (1 row)

 postgis15=# select st_area('POLYGON ((0.2563 0.2389, 0.2472 0.1259, 0.2094
 0.1202, 0.2294 0.1802, 0.2563 0.2389))');    st_area
 -------------
  0.002329765
 (1 row)
 }}}
 Here's the third example, also on an x64 box (OS/X in this case). Adding a
 fourth vertex between two of the others causes the result to shift to
 zero. And shifting the polygon back closer to the origin adds precision
 which brings the result closer to the result for the i386 numbers.
 Basically it looks like we are on a coarser precision grid, and the
 vertices are being snapped into that grid, which is pretty counter-
 intuitive since we are on 64 bit hardware. It's almost like we're in a 32-
 bit float space instead of a 64-bit double space. Something very deep is
 going on here.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/503#comment:3>
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