[postgis-devel] [PostGIS] #411: Invalid geometries are accepted in DB but no way to take them out

PostGIS trac at osgeo.org
Mon Feb 8 12:26:02 PST 2010


#411: Invalid geometries are accepted in DB but no way to take them out
-----------------------+----------------------------------------------------
  Reporter:  strk      |       Owner:  strk         
      Type:  defect    |      Status:  reopened     
  Priority:  critical  |   Milestone:  PostGIS 1.4.2
 Component:  postgis   |     Version:  1.4.X        
Resolution:            |    Keywords:               
-----------------------+----------------------------------------------------
Comment (by strk):

 I'm not sure we want to stop invalid geometries getting into the database.
 We don't do it for self-intersecting rings for example.

 In this case the invalidity is a non-closed ring (probably due to FP
 numbers).

 Mind you, with TRUNK st_isvalidreason would now tell you rather than throw
 an exception. 1.4 and 1.5 will only NOTICE you that.

 The table loaded with shp2pgsql have these invalidities:
 =# select gid, st_isvalidreason(the_geom) from "poly_molto_critici";
  gid |                                       st_isvalidreason
 -----+----------------------------------------------------------------------------------------------
    1 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
    2 | Self-intersection[1.70103e+06 4.89325e+06]
    3 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
    4 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
    5 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
    6 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
    7 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
    8 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
    9 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
   10 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
   11 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
   12 | IllegalArgumentException: Invalid number of points in LinearRing
 found 3 - must be 0 or >= 4
 (12 rows)


 Note gid number 2, and how the whole thing looks more consistent now ...
 :P

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