[gdal-dev] simple listing of layers by OGR
Frank Warmerdam
warmerdam at pobox.com
Thu Sep 17 16:16:15 EDT 2009
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