[gdal-dev] UnionCascaded operation failed

Casper Børgesen caboe at sdfe.dk
Sun Jun 30 22:39:04 PDT 2019


A very quick guess would be that you have changed the polyCollect type from a geometry type to a list of geometries. I don’t think the list of geometries has a UnionCascaded method. I would probably go for a polyCollect geometry type of MultiPolygon instead of the list/vector, that way you should be able to run the UnionCascaded method.

/Casper

From: gdal-dev <gdal-dev-bounces at lists.osgeo.org> On Behalf Of Ahmet Temiz
Sent: 29. juni 2019 19:47
To: gdal-dev <gdal-dev at lists.osgeo.org>
Subject: [gdal-dev] UnionCascaded operation failed

Hi,

Using C++ I try to buffers from LineStrings,Then I want to union the
resulting polygons with UnionCascaded.
But at UnionCascaded operation failed with:
"error: ‘class std::vector<OGRPolygon*>’ has no member named ‘UnionCascaded’
     OGRGeometry *result=polyCollect.UnionCascaded();
"
Can you tell me what I am doing wrong?

here is the related code fragment:

    std::vector<OGRPolygon * > polyCollect ;
    //OGRGeometryCollection *polyCollect ;

    while( (poFeature = poLayer->GetNextFeature()) != NULL )
    {

        OGRGeometry *poGeometry = poFeature->GetGeometryRef();

        if( poGeometry != NULL
                && wkbFlatten(poGeometry->getGeometryType()) == wkbLineString )
        {
            OGRLineString *poLine = (OGRLineString *) poGeometry;
   //
            OGRGeometry *bufGeometry = poLine->Buffer(100,30);
   OGRPolygon *bufPoly=  static_cast<OGRPolygon *> (bufGeometry) ;
            printf( "%s \n", bufPoly->getGeometryName());

   //polyCollect->addGeometryDirectly (bufPoly );
            polyCollect.push_back(bufPoly );
        }
        else
        {
            printf( "no point geometry\n" );
        }

        OGRFeature::DestroyFeature( poFeature );
    }

    OGRGeometry *result=polyCollect.UnionCascaded();

--
Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Bilgi İşlem  Dairesi Başkanlığı-CBS Grubu


________________________

Ahmet Temiz
Geological Eng.
Information Systems - GIS Group
Disaster and Emergency Management
of Presidency
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190701/12b2a500/attachment.html>


More information about the gdal-dev mailing list