0

I am trying to read the Projection from GeoTIFF/shapefile, using GDAL 1.9.0 by the following command in the command line...

gdalinfo.exe -proj4 map-path

but its retuning empty string for "PROJECTION" parameter... when I check the same map in QGIS getting the correct projection for this map.

Actually I want to retrieve "PROJECTION" value for any map from the C/C++ code, could you please let me know the way to retrieve this?

  • if it is a shapefile then you need to use ogrinfo – Ian Turton Jun 2 '13 at 16:08
  • Yes, I have tried for a geotif file, for that its returning empty string, same thing is happening for shape file in ogriinfo as well.... I used the code to get the projection of the raster map in as in gdalinfo.c . pszProjection = (char *) GDALGetProjectionRef( hDataset ); – Pradeep Jun 3 '13 at 10:50
1

Assuming that GDAL was installed in your Windows system with a procedure similar to this:

http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/

precisely one way to confirm successfully installation of GDAL is appealing to gdalinfo --version in a MS-DOS Console. By the way, I am using GDAL 1.10.1.

When I used a similar version of your command, for an arbitrary raster GTiff:

gdalinfo -proj4 c:/pyqgis_data/clip1.tif | find "proj"

I got this string:

'+proj=utm +zone=12 +datum=WGS84 +units=m +no_defs '

It worked well. I used a pipeline with find to filter by 'proj' because the default result of this command is too large.

  • Current Windows binaries for GDAL can be downloaded from gisinternals.com. The current version is 1.11.1, and 1.11.2 is just around the corner. – AndreJ Feb 15 '15 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.