[Gdal-dev] about ogrinfo

Frank Warmerdam warmerdam at pobox.com
Fri Mar 2 00:04:00 EST 2007

Lijian Shi wrote:
> Hi,
> I am a new guy of OGR. Today I use the followed command to browse the 
> information of a shp file:
> ogrinfo –al polygon.shp
> The result is the below. But when I read the code of ogrinfo, I did not 
> find the code used to print the information after “RATE: Real 
> (10.2)”(see below). Dose anyone know which part of the code to do that job?


The geometries are printed by calling dumpReadable() on the OGRGeometry
object (in OGRFeature::DumpReadable()).

The dumpReadable() method just converts the geometry to WKT (well known
text) format and prints that.

Each geometry class has it's own exportToWkt() method.  In this case
you are seeing the output of OGRPolygon::exportToWkt() which you can
find in gdal/ogr/ogrpolygon.cpp.

It can be a little tricky to trace these things through the code.

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    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list