[GRASS-user] Getting DATUM unknown when exporting to GTiff using r.out.gdal in python

Hello All,

I have written a python module (using Python26) to perform some operations on rasters and use r.out.gdal at the end to export the resulting raster grid to a geoTiff.

grass.read_command(“r.out.gdal”, input=inGrid, output=outTif, flags=“c”, nodata=nv, type=‘Float32’)

The problem is that the DATUM and SPHEROID information are not being properly exported from the LOCATION. If I run the exact same r.out.gdal command from the GRASS GUI on the same raster, the DATUM and SPHEROID are fine. The EPSG code for the projection that I am using is 27700 (OSGB National Grid). (The same happens when using another set of data with projection code EPSG:3035)

My question is: are GRASS and python using different projection libraries and, if so, what do I need to do to make the python version of r.out.gdal pick up the correct projection??

gdalinfo output on the python-run command gives:

Coordinate System is:

PROJCS[“Transverse Mercator”,

GEOGCS[“airy”,

DATUM[“unknown”,

SPHEROID[“unnamed”,6377563.396,299.3249646000044]],

PRIMEM[“Greenwich”,0]

but the gdalinfo output from the GRASS-run r.out.gdal command gives:

Coordinate System is:

PROJCS[“Transverse Mercator”,

GEOGCS[“airy”,

DATUM[“OSGB-1936”,

SPHEROID[“Airy 1830”,6377563.396,299.3249646000044,

AUTHORITY[“EPSG”,“7001”]],

AUTHORITY[“EPSG”,“6277”]],

PRIMEM[“Greenwich”,0]

Thanks for your help.

Anne

Anne Brookes

Senior Analyst

South Barn
Broughton Hall
Skipton
North Yorkshire
BD23 3AE
T: +44 (0)1756 799919 F: 0845 8627772

The JBA Family


www.jbaconsulting.com

This email is covered by JBA Consulting’s email disclaimer JBA Consulting is the trading name of Jeremy Benn Associates Limited, registered in England, company number 03246693, South Barn, Broughton Hall, Skipton, North Yorkshire, BD23 3AE.