[gdal-dev] Get SRID from image file
Paolo Corti
pcorti at gmail.com
Thu May 3 19:14:00 EDT 2012
On Fri, May 4, 2012 at 12:22 AM, Billy Newman <newmanw10 at gmail.com> wrote:
> I did not know that existed. A couple quick questions.
>
> 1. I do not want to store the entire raster file in the database. I just want to store the metadata, i.e. the bounding info and projection of the image file. The GeoRaster driver documentation made it seem like the entire raster file is being stored in the database.
>
> 2. I am running java processes with either jdbc or hibernate. Can I use this driver? Or is this only a command line utility?
>
> Thanks!
>
GDAL is both an API and a set of command line utilities (written from
the API itself).
The API is exposed by several languages binding, Java included.
You could try to do the following (code in Python, but easily
convertible to Java):
>>> from osgeo import gdal, osr
>>> ds = gdal.Open('landcover.img', 0)
>>> prj = ds.GetProjectionRef()
>>> srs = osr.SpatialReference(prj.title())
>>> print srs.GetAuthorityCode('GEOGCS') # or use PROJCS if the srs is projected
cheers
p
--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti
More information about the gdal-dev
mailing list