[gdal-dev] Convert OGRGeometry* to pointer to derived geometry type

Even Rouault even.rouault at spatialys.com
Sat Aug 14 05:30:48 PDT 2021


Brook,

toXXXX methods can still be used. We just have restricted invalid 
conversions, like a LineString to Polygon

A great part of what is valid is tested in

https://github.com/OSGeo/gdal/blob/1ec0b63d8820b2d3f0cfb792e05f3f5fea49892c/autotest/cpp/test_ogr.cpp#L787

Even

Le 14/08/2021 à 02:23, Brook Milligan a écrit :
> I would like to convert a pointer to OGRGeometry into a pointer to the appropriate derived type based upon the result of wkbFlatten(geometry->getGeometryType()).  It used to be possible to do this with functions like geometry->toLineString().  However, it seems that those are all deleted with the OGR_FORBID_DOWNCAST_TO(name) macro, although the functions are listed in the API documentation.
>
> How is this conversion supposed to be accomplished now?
>
> Thanks for any pointers.
>
> Cheers,
> Brook
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list