[GRASS5] [bug #2326] (grass) Missing row and column when importing raster map with r.in.gdal

this bug's URL: http://intevation.de/rt/webrt?serial_num=2326
-------------------------------------------------------------------------

Subject: Missing row and column when importing raster map with r.in.gdal

Platform: other
grass obtained from: Other (CDROM etc)
grass binary for platform: Downloaded precompiled Binaries
GRASS Version: 5.0.2 (April 2003)

I tried to import a raster grid with r.in.gdal, and apparently, a row and a column is missing in the
imported raster map (see below).

# Files and directories:
The files are located in the directory codem1nw:
dblbnd.adf
hdr.adf
log
prj.adf
sta.adf
w001001.adf
w001001x.adf

# w001001.adf (around 360 MB) contains the main data.

# Info from codem1nw/prj.adf (maybe not necessary):
Projection UTM
Zone 13
Datum NAD27
Zunits NO
Units METERS
Spheroid CLARKE1866
Xshift 0.0000000000
Yshift 0.0000000000
Parameters

# My default region:
GRASS 5.0.2 > g.region -pd
projection: 1 (UTM)
zone: 13
datum: nad27
ellipsoid: clark66
north: 4480020
south: 4380000
west: 235000
east: 340000
nsres: 30
ewres: 30
rows: 3334
cols: 3500

# gdalinfo:
GRASS 5.0.2 > gdalinfo --version
GDAL 1.1.9.0, released 2003/06/27

# Libraries:
ls -la /usr/local/lib:
-rwxr-xr-x 1 christof admin 3902472 23 Jan 09:33 libgdal.1.1.9.dylib
-rwxr-xr-x 1 christof admin 1363420 1 Jun 2001 libgdal.1.1.dylib

# Import of raster map:
r.in.gdal -o in=codem1nw out=codem1nw.r
r.support -r codem1nw.r
# There were no error messages during the import.

# Info from gdalinfo:
GRASS 5.0.2 > gdalinfo codem1nw
Driver: AIG/Arc/Info Binary Grid
Size is 10418, 8949
Coordinate System is:
PROJCS["UTM Zone 13, Northern Hemisphere",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.978698213898,
                AUTHORITY["EPSG","7008"]],
            TOWGS84[-3,142,183,0,0,0,0],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9108"]],
        AXIS["Lat",NORTH],
        AXIS["Long",EAST],
        AUTHORITY["EPSG","4267"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-105],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["METERS",1]]
Origin = (131904.828978,4561132.087882)
Pixel Size = (27.27543571,-27.27543571)
Corner Coordinates:
Upper Left ( 131904.829, 4561132.088)
Lower Left ( 131904.829, 4317044.214)
Upper Right ( 416060.318, 4561132.088)
Lower Right ( 416060.318, 4317044.214)
Center ( 273982.574, 4439088.151)
Band 1 Block=256x4 Type=Float32, ColorInterp=Undefined
  Min=1280.949 Max=4412.362
  NoData Value=-3.40282e+38

# Note the size (10418, 8949)

# Info from the imported raster map:
GRASS 5.0.2 > r.info codem1nw.r
+----------------------------------------------------------------------------+
| Layer: codem1nw.r Date: Tue Feb 17 19:20:36 2004 |
| Mapset: data1 Login of Creator: christof |
| Location: fire_flattops |
| DataBase: /Volumes/FatBoy2/Users/christof/Work/Postdoc/Grass_data |
| Title: ( codem1nw.r ) |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 4412 |
| Data Type: FCELL |
| Rows: 8948 |
| Columns: 10417 |
| Total Cells: 93211316 |
| Projection: UTM (zone 13) |
| N: 4561145.72559973 S: 4317085.1268369 Res: 27.27543571 |
| E: 416019.40508569 W: 131891.19125998 Res: 27.27543571 |
| Range of data: min = 0.000000 max = 4412.000000 |
| |
| Data Source: |
| |
| |
| |
| Data Description: |
| generated by r.in.gdal |
| |
| |
+----------------------------------------------------------------------------+

# Note the size (10417, 8948)

Using r.in.gdal -e ... or r.in.gdal ... location=newlocation did not change anything.

This bug was submitted by Christof Bigler (Boulder, Colorado). If you need more information send
me an e-mail.
See also:
http://www.ecosconsult.com.br/grass-list/arq/11524.html
http://www.ecosconsult.com.br/grass-list/arq/11539.html
http://www.ecosconsult.com.br/grass-list/arq/11556.html

Thanks,
Christof

-------------------------------------------- Managed by Request Tracker

I'm not sure, but rather than blaming r.in.gdal I think the original data
is ill-formatted.

(e - w) / ew-res and (n - s) / ns-res should be even numbers, but

(416060.318 - 131904.829) / 27.27543571 = 10417.999991686
(4561132.088 - 4317044.214) / 27.27543571 = 8948.9999938117

So, looks like r.in.gdal, rather than rounding up to 10418 and 8949, or
changing the resolution, trims half of the failing last row/column off
each side of the map.

Don't know if r.in.gdal in newer grass versions still does that, but I
would not consider it a bug. I think it would be more of a bug to round
cell number upwards, even if values here are rather close, since
resolution is given with 8 significant decimals.

rgds
Morten Hulden

On Wed, 18 Feb 2004, Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=2326
-------------------------------------------------------------------------

Subject: Missing row and column when importing raster map with r.in.gdal

Platform: other
grass obtained from: Other (CDROM etc)
grass binary for platform: Downloaded precompiled Binaries
GRASS Version: 5.0.2 (April 2003)

I tried to import a raster grid with r.in.gdal, and apparently, a row and a column is missing in the
imported raster map (see below).

# Files and directories:
The files are located in the directory codem1nw:
dblbnd.adf
hdr.adf
log
prj.adf
sta.adf
w001001.adf
w001001x.adf

# w001001.adf (around 360 MB) contains the main data.

# Info from codem1nw/prj.adf (maybe not necessary):
Projection UTM
Zone 13
Datum NAD27
Zunits NO
Units METERS
Spheroid CLARKE1866
Xshift 0.0000000000
Yshift 0.0000000000
Parameters

# My default region:
GRASS 5.0.2 > g.region -pd
projection: 1 (UTM)
zone: 13
datum: nad27
ellipsoid: clark66
north: 4480020
south: 4380000
west: 235000
east: 340000
nsres: 30
ewres: 30
rows: 3334
cols: 3500

# gdalinfo:
GRASS 5.0.2 > gdalinfo --version
GDAL 1.1.9.0, released 2003/06/27

# Libraries:
ls -la /usr/local/lib:
-rwxr-xr-x 1 christof admin 3902472 23 Jan 09:33 libgdal.1.1.9.dylib
-rwxr-xr-x 1 christof admin 1363420 1 Jun 2001 libgdal.1.1.dylib

# Import of raster map:
r.in.gdal -o in=codem1nw out=codem1nw.r
r.support -r codem1nw.r
# There were no error messages during the import.

# Info from gdalinfo:
GRASS 5.0.2 > gdalinfo codem1nw
Driver: AIG/Arc/Info Binary Grid
Size is 10418, 8949
Coordinate System is:
PROJCS["UTM Zone 13, Northern Hemisphere",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.978698213898,
                AUTHORITY["EPSG","7008"]],
            TOWGS84[-3,142,183,0,0,0,0],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9108"]],
        AXIS["Lat",NORTH],
        AXIS["Long",EAST],
        AUTHORITY["EPSG","4267"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-105],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["METERS",1]]
Origin = (131904.828978,4561132.087882)
Pixel Size = (27.27543571,-27.27543571)
Corner Coordinates:
Upper Left ( 131904.829, 4561132.088)
Lower Left ( 131904.829, 4317044.214)
Upper Right ( 416060.318, 4561132.088)
Lower Right ( 416060.318, 4317044.214)
Center ( 273982.574, 4439088.151)
Band 1 Block=256x4 Type=Float32, ColorInterp=Undefined
  Min=1280.949 Max=4412.362
  NoData Value=-3.40282e+38

# Note the size (10418, 8949)

# Info from the imported raster map:
GRASS 5.0.2 > r.info codem1nw.r
+----------------------------------------------------------------------------+
| Layer: codem1nw.r Date: Tue Feb 17 19:20:36 2004 |
| Mapset: data1 Login of Creator: christof |
| Location: fire_flattops |
| DataBase: /Volumes/FatBoy2/Users/christof/Work/Postdoc/Grass_data |
| Title: ( codem1nw.r ) |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 4412 |
| Data Type: FCELL |
| Rows: 8948 |
| Columns: 10417 |
| Total Cells: 93211316 |
| Projection: UTM (zone 13) |
| N: 4561145.72559973 S: 4317085.1268369 Res: 27.27543571 |
| E: 416019.40508569 W: 131891.19125998 Res: 27.27543571 |
| Range of data: min = 0.000000 max = 4412.000000 |
| |
| Data Source: |
| |
| |
| |
| Data Description: |
| generated by r.in.gdal |
| |
| |
+----------------------------------------------------------------------------+

# Note the size (10417, 8948)

Using r.in.gdal -e ... or r.in.gdal ... location=newlocation did not change anything.

This bug was submitted by Christof Bigler (Boulder, Colorado). If you need more information send
me an e-mail.
See also:
http://www.ecosconsult.com.br/grass-list/arq/11524.html
http://www.ecosconsult.com.br/grass-list/arq/11539.html
http://www.ecosconsult.com.br/grass-list/arq/11556.html

Thanks,
Christof

-------------------------------------------- Managed by Request Tracker

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5