[GRASS-user] tiff imported to GRASS loses minus sign in west coordinate

Micha Silver micha at arava.co.il
Thu Oct 28 16:49:26 EDT 2010


On 10/28/2010 07:56 PM, A. Marcia BARBOSA wrote:
> Dear lists,
>
> I need to import the map available here
> (http://geodata.grid.unep.ch/mod_download/download_geospatial.php?selectedID=2150&newFile=download/Nightlights_2003_tif.zip)
> to GRASS. The map is in Tiff format and appears fine in QGIS, but when
> I import it to GRASS (with r.in.gdal) it becomes a very narrow N-S
> stripe.
>
> Here's the raster info that QGIS gives me on this map:
>
>
>    

I think I know what the problem is. Have a look at the bounds below:
> Corner Coordinates:
> Upper Left  (-180.0041667,  65.0041667) (180d 0'15.00"W, 65d 0'15.00"N)
> Lower Left  (-180.0041667, -65.0041661) (180d 0'15.00"W, 65d 0'15.00"S)
> Upper Right ( 180.0041652,  65.0041667) (180d 0'14.99"E, 65d 0'15.00"N)
> Lower Right ( 180.0041652, -65.0041661) (180d 0'14.99"E, 65d 0'15.00"S)
>    
The left (W)  extent goes beyond -180 and the right (E) also goes beyond 
+180. So the image has "fallen off the edge" ;-)
If I check with gdalinfo on the original tiff, before importing into 
GRASS, here's what I see:

micha at hayun-820:~/Download$ gdalinfo Nightlights_2003.tif
Driver: GTiff/GeoTIFF
Size is 43201, 15601
... more lines ...
Pixel Size = (0.008333330042660,-0.008333330042660)
... more metadata ...
Corner Coordinates:
Upper Left  (-180.0000000,  65.0000000) (180d 0'0.00"W, 65d 0'0.00"N)
Lower Left  (-180.0000000, -65.0082820) (180d 0'0.00"W, 65d 0'29.82"S)
Upper Right ( 180.0081912,  65.0000000) (180d 0'29.49"E, 65d 0'0.00"N)
Lower Right ( 180.0081912, -65.0082820) (180d 0'29.49"E, 65d 0'29.82"S)
Center      (   0.0040956,  -0.0041410) (  0d 0'14.74"E,  0d 0'14.91"S)

Here again the Right side is > 180. So, in import to GRASS, it gets 
"wrapped" to the west, and the end result is, like above, a very narrow 
raster with E-W extent 0.0000015 degrees.

One way to work this out is to clip the original raster slightly before 
importing. The gdal tool gdal_translate does this with the -projwin 
option like:
gdal_translate -projwin -179.99 65 179.99 -65 Nightlights_2003.tif 
Nightlights_2003clip.tif

Here, I've shaved off a bit on the E and W so it fits into the -180 to 
180 bounds. Now if I redo r.in.gdal using the clipped raster, it appears 
correctly in GRASS.

-- 
Micha

> Thanks for any help,
> Márcia
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> This mail was received via Mail-SeCure System.
>
>
>    


-- 
Micha Silver
Arava Development Co. +972-52-3665918
http://surfaces.co.il




More information about the grass-user mailing list