[gdal-dev] Use Ogr Geometry childs classes in C#.

Even Rouault even.rouault at mines-paris.org
Thu Jul 26 01:33:35 PDT 2012

Selon Benjamin <benjamin.lux at maxsea.fr>:

> Hi,
> I code in C# with Ogr wrapers - gdal_csharp.dll, gdalconst_csharp.dll,
> ogr_csharp.dll and osr_csharp.dll -
> "release-1600-x64-gdal-1-9-0-mapserver-6-0-1".
> I want use specifics polygon methods on my geometry as "OGRLinearRing *
> OGRPolygon::getInteriorRing ( int iRing )".
> (see
> But it seems that the Polygon classe doesn't exist with the C# wraper.
> There is a enum wkbGeometryType but not the class.

Indeed, at the bindings level, only a Geometry class exists. It has a
GetGeometryRef(int) method that, for polygons, is such that :

- GetGeometryRef(0) returns the exterior ring
- GetGeometryRef(n) with n>=1 return what OGRPolygon::getInteriorRing(n-1) would

For multi-geometries, such as multipolygon, multilinestring, multipoint or
geometrycollection, GetGeometryRef(n) returns the n(th) (starting from 0)
sub-geometry in the multi-geometry.

More information about the gdal-dev mailing list