[gdal-dev] simple listing of layers by OGR

Yilmaz Arslanoglu yilmaz.arslanoglu at gmail.com
Thu Sep 17 09:05:57 EDT 2009

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.


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)
3: BCNLAT (Point)
4: BCNSPP (Point)
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?

More information about the gdal-dev mailing list