Hi Ahmet

I haven’t visited C++ and ogr for quite some time, but I think you should 
define and initialize polyCollect like this:

OGRMultiPolygon *polyCollect = new OGRMultiPolygon();

This type should implement the UnionCascaded() method.

Maybe other users on the list can chime in?

/Casper

From: Ahmet Temiz <[email protected]>
Sent: 1. juli 2019 09:04
To: Casper Børgesen <[email protected]>
Subject: Re: [gdal-dev] UnionCascaded operation failed

Hi,

It is geometry list indeed as:
 std::vector<OGRPolygon * > polyCollect ;

I converted it to OGRMultiPolygon
But
 OGRGeometry *result=polyCollect.UnionCascaded();  // ???
still failed


On Mon, Jul 1, 2019 at 8:55 AM Ahmet Temiz 
<[email protected]<mailto:[email protected]>> wrote:
Ok, thanks.

On Mon, Jul 1, 2019 at 8:39 AM Casper Børgesen 
<[email protected]<mailto:[email protected]>> wrote:
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 
<[email protected]<mailto:[email protected]>> On 
Behalf Of Ahmet Temiz
Sent: 29. juni 2019 19:47
To: gdal-dev <[email protected]<mailto:[email protected]>>
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


--
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


--
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
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to