Jim, On Mon, Jun 8, 2015 at 10:11 AM, Tilton, James C. (GSFC-6063) <[email protected]> wrote: > I seem to be missing some key point in understanding the use of OGR > Projections. > > > > The OGR Projections Tutorial (www.gdal.org/osr_tutorial.html) very clearly > describes how to set up a new OGRSpatialReference, > > but does not tell how to determine and query the OGRSpatialReference from an > existing image data set (e.g. and GeoTiff image). > > > > Could someone please point me to examples/instructions on how to do this?
See gdalsrsinfo: http://www.gdal.org/gdalsrsinfo.html and the source: https://trac.osgeo.org/gdal/browser/trunk/gdal/apps/gdalsrsinfo.cpp For a geotiff, it'd be something like: GDALDatasetH hDS = GDALOpen("mytiff.tif", GA_ReadOnly); const char *pszWkt = GDALGetProjectionRef(hDS); OGRSpatialReferenceH hSRS; hSRS = OSRNewSpatialReference(pszWkt); using the C API (and not doing error checking, obviously). > > > > Thanks. > > > > Jim Tilton > > ________________________________ > > Dr. James C. Tilton Voice: > 301-286-9510 > > NASA Goddard Space Flight Center FAX: 301-286-1776 > > Mail Code 606.3 E-Mail: > [email protected] > > (Computational & Information Sciences and Technology Office) > > Greenbelt, MD 20771 > > URLs: > http://science.gsfc.nasa.gov/sed/index.cfm?fuseAction=home.main&&navOrgCode=606 > > and . http://geography.wr.usgs.gov/science/croplands/index.html > > > > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Kyle _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
