I have recently started using GDAL in C#, I want to get a value from a field of a feature using the name of that field. In the docs here it says that the operator [char*] is supported, however it's not in the .net package.

Here is my code

 Feature feature = layer.GetNextFeature();
 var field = feature['myField']; // not recognized :(

Is there a way to get a value by field name from the feature ?


As a workaround there are some functions in order to get a typed value by name. In my case I'm using feature.GetFieldAsString("myField")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.