[GRASS-user] OpenFileGDB input error

Even Rouault even.rouault at spatialys.com
Thu Sep 28 13:45:15 PDT 2017


On jeudi 28 septembre 2017 22:34:55 CEST Even Rouault wrote:
> > By now, v.in.ogr is peppered with #if GDAL_VERSION_NUM >= X, looks like at
> > some stage we should have two versions, one for GDAL 1.x, another one for
> > GDAL 2.x...
> 
> Seems to me that having 2 version of th code would be more difficult to
> maintain.
> 
> To avoid cluttering the code with condition related to
> OGR_G_GetLinearGeometry() for older GDAL, you could create a dummy
> implementation of OGR_G_GetLinearGeometry at the top of the file for GDAL <
> 2 that just does a OGR_G_Clone()
> 
> #if GDAL_VERSION_NUM < 2000000
> static OGRGeometryH my_OGR_G_GetLinearGeometry(OGRGeometryH hGeom, double
> unused1, char** unused2)
> {
>    (void)unused1;
>    (void)unused2;
>    return OGR_G_Clone(hGeom);
> }
> #define OGR_G_GetLinearGeometry my_OGR_G_GetLinearGeometry
> #endif
> 
> (untested)
> 

Ah, and related with that, starting with GDAL 2.2, you can also get new geometry types, 
TRIANGLE, TIN and POLYHEDRALSURFACE.
https://trac.osgeo.org/gdal/wiki/rfc64_triangle_polyhedralsurface_tin

TIN can typically be found in some shapefiles and FileGDB. POLYHEDRALSURFACE from some 
GML.

To test easily, you can create a simple csv:

id,WKT
1,"TRIANGLE ((0 0,0 1,1 1,0 0))"
2,"TIN (((0 0,0 1,1 1,0 0)))"
3,"POLYHEDRALSURFACE (((0 0,0 1,1 1,0 0)))"

If you don't want to directly deal with those beasts in their native form, you can force them 
to more standard types with:

wkbTriangle : OGR_G_ForceTo( , wkbPolygon)
wkbTIN / wkbPolyhedralSurface: OGR_G_ForceTo( , wkbMultiPolygon)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170928/0c840bfe/attachment.html>


More information about the grass-user mailing list