[GRASS-user] Wrong projection info after importing Geotif

Agustin Lobo aloboaleu at gmail.com
Wed Oct 22 14:19:59 EDT 2008


Markus,

You are right that the file I'm using is not quite the
one of the link that I included in my message. I actually
passed that map to R, and just redifined:
 >b <-  npp_geotiff
 >b at data$band1[b at data$band1  <0 ]<- 0

and then wrote b as npp.tif (I used QGIS manageR)

But I do not
think that this is a matter of concern. The point is that
the geographic info displayed by gdal for npp.tif is correct
(the "90d 2'30.00"S" problem is not in this file)
while the region set by grass from it with
g.region rast=npp.tif
is not.

I guess that the r.in.gdal I have is older (and wrong) than yours,
mine is the one in QGIS 1.0preview:
GRASS > g.version
GRASS 6.3.0 (2008)

Thus I don't think there is any way to solve this, except
installing a 6.4 version, import ant then copy to the LOCATIOn and 
mapset I would use with QGIS. Am I wrong?

Agus

Markus Neteler wrote:
> On Wed, Oct 22, 2008 at 10:34 AM, Agustin Lobo <aloboaleu at gmail.com> wrote:
>> Hi!
>>
>> I'm trying to import a geotif file
>> (http://user.uni-frankfurt.de/~grieser/downloads/NetPrimaryProduction/npp_CruP_All_fine_geo.zip)
> 
> Note that the map exceeds South!
> 
> 
> gdalinfo npp_CruP_All_fine_geo.tif
> Driver: GTiff/GeoTIFF
> Files: npp_CruP_All_fine_geo.tif
> Size is 4320, 2160
> Coordinate System is:
> GEOGCS["WGS 84",
>  ...
> Metadata:
>   AREA_OR_POINT=Area
> ...
> Pixel Size = (0.083333333343262,-0.083333333343262)
> ...
> Corner Coordinates:
> Upper Left  (-179.9583334,  89.9583333) (179d57'30.00"W, 89d57'30.00"N)
> Lower Left  (-179.9583334, -90.0416667) (179d57'30.00"W, 90d 2'30.00"S)
> Upper Right ( 180.0416667,  89.9583333) (180d 2'30.00"E, 89d57'30.00"N)
> Lower Right ( 180.0416667, -90.0416667) (180d 2'30.00"E, 90d 2'30.00"S)
> Center      (   0.0416667,  -0.0416667) (  0d 2'30.00"E,  0d 2'30.00"S)
> Band 1 Block=4320x1 Type=Byte, ColorInterp=Gray
>   NoData Value=254
>   Offset: 0,   Scale:10.4598910148779
> 
> -> 90d 2'30.00"S does not quite exist.
> 
> Looking at North:
>> 89.9583333+0.083333333343262
> [1] 90.04167
> 
> I suspect a pixel-refers-to-center versus pixel-refers-to-corner bug in the
> map.
> 
>> I import the geotif file with:
>>  r.in.gdal input=/media/mifat32/MASTER_ICTA2007_2008/2008b/npp.tif
>> output=npp
> 
> Here I get
> 
> GRASS 6.4.svn (latlong):~ > r.in.gdal npp_CruP_All_fine_geo.tif out=test
> Projection of input dataset and current location appear to match
> WARNING: Fixing subtle input data rounding error of south boundary
>          (-0.0416667>4.62963e-07)
>  100%
> <test> created
> r.in.gdal complete.
> 
> -> South is "fixed" (not necessarily correct, though, see above).
> 
> GRASS 6.4.svn (latlong_tbe_climate):~ > g.region rast=test -p
> projection: 3 (Latitude-Longitude)
> zone:       0
> datum:      wgs84
> ellipsoid:  wgs84
> north:      89:57:30.000039N
> south:      90S
> west:       179:57:30.000077W
> east:       179:57:29.999923W
> nsres:      0:05:00.069477
> ewres:      0
> rows:       2159
> cols:       4320
> cells:      9326880
> 
> -> Global wrap around problem... due to the apparently shifted map:
> 179d57'30.00"W and 180d 2'30.00"E do not look right to me.
> 
> 
>> But, according to gdalinfo, the geotif file is correct:
>>
>> $ gdalinfo npp.tif
>> Driver: GTiff/GeoTIFF
>> Files: npp.tif
>> Size is 1440, 572
> ...
> 
> You are looking at a different file here, comparing the size and the
> coordinates.
> 
> The map in the ZIP file doesn't look properly positioned to me.
> Subsequently GRASS fails.
> 
> Markus
> 

-- 
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster


More information about the grass-user mailing list