[gdal-dev] simple listing of layers by OGR

Yilmaz Arslanoglu yilmaz.arslanoglu at gmail.com
Fri Sep 18 06:21:21 EDT 2009


Frank, thank you very much for the answer.

Yes, I use the "ogrinfo" application that comes with the FWTools installation.
( Thanks by the way for this wonderful set of tools  )
For my own application, I just built the GDAL library with
default configuration options, just changing the compiler
version to 1500 (stating that I'm using Visual Studio 2008)

Ok, let me apply the changes that you proposed.

Best regards,
Yilmaz

On Thu, Sep 17, 2009 at 10:16 PM, Frank Warmerdam <warmerdam at pobox.com> wrote:
> Yilmaz Arslanoglu wrote:
>>
>> Hello everybody;
>>
>> First of all, I would like to say that I am quite new in S-57 format
>> and GDAL/OGR libraries.
>>
>> As a starting point, I downloaded the source codes and built the whole
>> GDAL library on my computer,
>> using the "nmake" of Visual Studio 2008.
>>
>> Now:
>>
>> poDS = OGRSFDriverRegistrar::Open( "US5LA24M.000", FALSE );
>> for (int i = 0; i < poDS->GetLayerCount(); i++)
>>  printf("layer %d: %s\n", i,
>> poDS->GetLayer(i)->GetLayerDefn()->GetName());
>>
>> When I try to list the layer names of a datasource with the code snippet
>> above,
>> I get the following result:
>>
>> layer 0: DSID
>> layer 1: Point
>> layer 2: Line
>> layer 3: Area
>> layer 4: Meta
>>
>> However, the utility application "ogrinfo" gives a quite different
>> result as follows:
>> (when run with command  "ogrinfo US5LA24M.000" )
>>
>> 1: DSID (None)
>> 2: ACHARE
>> 3: BCNLAT (Point)
>> 4: BCNSPP (Point)
>> 5: BUISGL
>> ...
>> ...
>> ...
>> 49: M_QUAL (Polygon)
>> 50: C_ASSO (None)
>>
>> I examined the source code of "ogrinfo" under the "gdal-1.6.2\apps\"
>> directory, however,
>> I could not find a difference in terms of listing the layers in the
>> dataset.
>>
>> What could be the problem, is there a point that I'm missing?
>
> Yilmaz,
>
> In the case where you only get DSID, Point, Line, Area and Meta
> layers the OGR S-57 driver was unable to find the s57 object class
> .csv files at runtime in order to properly categorize things in
> feature classes.
>
> This might be accomplished by setting the GDAL_DATA configuration
> variable either via the environment or the CPLSetConfigOption()
> function.  Were you using ogrinfo from an environment like
> OSGeo4W or FWTools that sets up the environment carefully?
>
> In some form this question needs to be in the FAQ!
>
> 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