[Gdal-dev] How to get value of an attribute within an object class

Frank Warmerdam warmerdam at pobox.com
Tue Oct 2 11:06:30 EDT 2007


On 10/2/07, tjansson <tommy.jansson at kongsberg.com> wrote:
>
> I've already tried that, and the value I get in return has until now always
> been 0 (zero).
>
> First I use int iOBJL = poFDefn->GetFieldIndex("OBJL"); to get the object
> label code ID from the appurtenant feature definition.
>
> Then this return value is used to get all features of type DPTCNT (code 43)
> if (43 == poFeature->GetFieldAsInteger(iOBJL))....
>
> Thereafter I've tried both double dValDCo =
> poFeature->GetFieldAsDouble(174); (where 174 should be the code for VALDCO)
> and double dValDCo = poFeature->GetFieldAsDouble("VALDCO");, but the return
> value is always 0 (zero).
>
> I've tried several maps, most of them downloaded from NOAA, but the result
> is always the same. Am I missing something?

Tommy,

Does ogrinfo report the corect VALDCO values for these features?
Based on your use of OBJL I'm starting to suspect the S-57
support files are not being found, and so all the extended
per-feature-class attributes are not being found.  The solution
to that is to set the GDAL_DATA environment variable to point
the directory with the s57objectclasses.csv and related files.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the Gdal-dev mailing list