[gdal-dev] Getting geometry fields through the c# wrapper

Tom Lewis tglewis1993 at gmail.com
Tue Sep 29 06:52:32 PDT 2020


 Hi,

I am trying to get the geometry fields through the GDAL.OGR c# wrapper.

I need to loop through and print every field (with name) on every geometry
in a feature. I am looking for the QUAPOS field in the geometry (if
applicable) but am unsure which combination of definitions and functions to
use, as GeomFieldDef names always seem to return blank.

What I tried was:

Use feature.GetGeomFieldCount to set up a loop between 0 -> fieldCount.
For each iteration, use the loop index with feature.GetGeomFieldRefnDef()
to get the GeomFieldDefn instance (which was not null).
With this GeomFieldDefn use the GetNameRef (also tried just GetName)
function to get the fields name. (Not sure how to get the value of the
field in this method, but the return was always blank so it wouldn't matter
I suspect. I tried with the fields SpatialRef, but that didn't work.)

I am probably just woefully misunderstanding the documentation and
apologies if this is a simple question, but I have had no luck finding any
answers through the search engines for this.

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200929/0ef499aa/attachment.html>


More information about the gdal-dev mailing list