[postgis-devel] [PostGIS] #1703: Parse error on WKT for multi with empty elements

PostGIS trac at osgeo.org
Thu Mar 22 01:31:44 PDT 2012


#1703: Parse error on WKT for multi with empty elements
---------------------+------------------------------------------------------
 Reporter:  strk     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.0
Component:  postgis  |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------
 {{{
 strk=# select
 ST_summary('010700000002000000010600000002000000010300000000000000010300000001000000050000000000000000003440000000000000000000000000000034400000000000003440000000000000444000000000000034400000000000004440000000000000000000000000000034400000000000000000010100000000000000000024400000000000002440'::geometry);
               st_summary
 ---------------------------------------
  GeometryCollection[B] with 2 elements+
    MultiPolygon[] with 2 elements     +
      Polygon[] with 0 rings           +
                                       +
      Polygon[] with 1 rings           +
     ring 0 has 5 points               +
    Point[]
 (1 row)
 }}}

 You can see the first element is MULTIPOLYGON with an EMPTY and a non-
 EMPTY element.

 ST_IsValid returns true on it, but ST_AsText and ST_AsEWKT both given a
 representation which is not understood correctly on parsing:

 {{{
  GEOMETRYCOLLECTION(MULTIPOLYGON( EMPTY,((20 0,20 20,40 20,40 0,20
 0))),POINT(10 10))
 }}}

 The parser refuses to parse it back:

 {{{
 =# select
 ST_AsText('010700000002000000010600000002000000010300000000000000010300000001000000050000000000000000003440000000000000000000000000000034400000000000003440000000000000444000000000000034400000000000004440000000000000000000000000000034400000000000000000010100000000000000000024400000000000002440'::geometry)::geometry;
 ERROR:  parse error - invalid geometry
 }}}

 I don't think it's fair :)

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1703>
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