[postgis-devel] [PostGIS] #564: ST_DumpPoints support for Polyhedral Surfaces

PostGIS trac at osgeo.org
Wed Aug 11 01:10:52 PDT 2010


#564: ST_DumpPoints support for Polyhedral Surfaces
---------------------+------------------------------------------------------
 Reporter:  robe     |       Owner:  pramsey      
     Type:  task     |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.0
Component:  postgis  |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------

Comment(by yabo):

 Hi,

 The problem is that ST_DumpPoints doesn't use the ST_IsCollection
 function. Here's a patch that fixes the problem and adds some regression
 tests to ST_IsCollection and ST_DumpPoints for PolyhedralSurface.

 {{{
 Index: postgis/postgis.sql.in.c
 ===================================================================
 --- postgis/postgis.sql.in.c    (revision 5806)
 +++ postgis/postgis.sql.in.c    (working copy)
 @@ -1943,17 +1943,14 @@
    i integer;
    j integer;
    g geometry;
 -  typ text;

  BEGIN

    RAISE DEBUG '%,%', cur_path, ST_GeometryType(the_geom);

 -  -- Special case (MULTI* OR GEOMETRYCOLLECTION) : iterate and return the
 DumpPoints of the geometries
 -  SELECT ST_GeometryType(the_geom) INTO typ;
 +  -- Special case collections : iterate and return the DumpPoints of the
 geometries

 -  -- Dont we have an ST_isMulti ?
 -  IF (typ like 'ST_Multi%' OR typ = 'ST_GeometryCollection') THEN
 +  IF (ST_IsCollection(the_geom)) THEN

      i = 1;
      FOR tmp2 IN SELECT (ST_Dump(the_geom)).* LOOP
 Index: regress/iscollection_expected
 ===================================================================
 --- regress/iscollection_expected       (revision 5806)
 +++ regress/iscollection_expected       (working copy)
 @@ -13,3 +13,6 @@
  empty collection|t
  collection|t
  collection+|t
 +empty polyhedralsurface|t
 +polyhedralsurface|t
 +polyhedralsurface+|t
 Index: regress/dumppoints.sql
 ===================================================================
 --- regress/dumppoints.sql      (revision 5806)
 +++ regress/dumppoints.sql      (working copy)
 @@ -93,6 +93,28 @@
    SELECT (ST_DumpPoints(g.geom)).*
    FROM
      (SELECT
 +       'POLYHEDRALSURFACE (((
 +                0 0 0,
 +                0 0 1,
 +                0 1 1,
 +                0 1 0,
 +                0 0 0
 +            )), ((
 +                0 0 0,
 +                0 1 0,
 +                1 1 0,
 +                1 0 0,
 +                0 0 0
 +            ))
 +            )'::geometry AS geom
 +    ) AS g
 +  ) j;
 +
 +SELECT path, ST_AsText(geom)
 +FROM (
 +  SELECT (ST_DumpPoints(g.geom)).*
 +  FROM
 +    (SELECT
         'GEOMETRYCOLLECTION(
            POINT(99 98),
            LINESTRING(1 1, 3 3),
 Index: regress/dumppoints_expected
 ===================================================================
 --- regress/dumppoints_expected (revision 5806)
 +++ regress/dumppoints_expected (working copy)
 @@ -35,6 +35,16 @@
  {2,2,2}|POINT(6 8)
  {2,2,3}|POINT(8 8)
  {2,2,4}|POINT(7 6)
 +{1,1,1}|POINT(0 0 0)
 +{1,1,2}|POINT(0 0 1)
 +{1,1,3}|POINT(0 1 1)
 +{1,1,4}|POINT(0 1 0)
 +{1,1,5}|POINT(0 0 0)
 +{2,1,1}|POINT(0 0 0)
 +{2,1,2}|POINT(0 1 0)
 +{2,1,3}|POINT(1 1 0)
 +{2,1,4}|POINT(1 0 0)
 +{2,1,5}|POINT(0 0 0)
  {1,1}|POINT(99 98)
  {2,1}|POINT(1 1)
  {2,2}|POINT(3 3)
 Index: regress/iscollection.sql
 ===================================================================
 --- regress/iscollection.sql    (revision 5806)
 +++ regress/iscollection.sql    (working copy)
 @@ -25,4 +25,6 @@
  SELECT 'collection', ST_IsCollection('GEOMETRYCOLLECTION(POINT(0 0))');
  SELECT 'collection+', ST_IsCollection('GEOMETRYCOLLECTION(POINT(0 0),
 POINT(42 42))');

 -
 +SELECT 'empty polyhedralsurface', ST_IsCollection('POLYHEDRALSURFACE
 EMPTY');
 +SELECT 'polyhedral', ST_IsCollection('POLYHEDRALSURFACE(((0 0 0, 0 0 1, 0
 1 1, 0 1 0, 0 0 0)))');
 +SELECT 'polyhedral+', ST_IsCollection('POLYHEDRALSURFACE(((0 0 0, 0 0 1,
 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)))');
 }}}

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