[gdal-dev] Querying Geographic Coordinate System from an existing image file.
Kyle Shannon
kyle at pobox.com
Mon Jun 8 09:58:02 PDT 2015
Jim,
On Mon, Jun 8, 2015 at 10:11 AM, Tilton, James C. (GSFC-6063)
<james.c.tilton at nasa.gov> 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:
> James.C.Tilton at nasa.gov
>
> (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
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Kyle
More information about the gdal-dev
mailing list