[gdal-dev] Need help if OGR C-API

Stephen Woodbridge woodbri at swoodbridge.com
Fri Sep 3 12:45:56 EDT 2010


Hi all,

Trying to convert a shapelib program over to OGR and have to say it is 
very complicated.

I'm using: GDAL 1.7.2, released 2010/04/23

At the moment I stuck on:

   hDSin = OGROpen( "Streets.shp", FALSE, NULL );
   hLayerIn = OGR_DS_GetLayerByName( hDSin, "Streets" );

   hFDefnIn = OGR_L_GetLayerDefn( hLayerIn );
   layerGeomType = OGR_FD_GetGeomType( hFDefnIn );

And always returns:   layerGeomType == wkbUnknown

And OGR_L_GetGeomType( hLayerIn )  does not appear until 1.8.

ogrinfo -so Streets.shp Streets
INFO: Open of `Streets.shp'
       using driver `ESRI Shapefile' successful.

Layer name: Streets
Geometry: Line String
Feature Count: 102958
Extent: (-71.888528, 42.156701) - (-71.020913, 42.734315)
Layer SRS WKT:
(unknown)
LINK_ID: Integer (10.0)
NAME: String (80.0)
...

So how do I get the geometry type of the shapefile?

-Steve


More information about the gdal-dev mailing list