[GRASSLIST:10307] importing big ECW file with r.in.gdal

Hi *,

I am trying to import a big (~1.7GB) ECW file downloaded from

http://www.geotorrent.org/details.php?id=30

I can visualize this raster map in QGIS without any problems. I would
like to import it into a GRASS location. I have used r.in.gdal module,
but the import was not successful. The RGB channels were generated,
for example the green one:

+----------------------------------------------------------------------------+
  | Layer: eu.blue Date: Mon Feb 13 01:31:46 2006 |
  | Mapset: PERMANENT Login of Creator: martin |
| Location: eu_mozaika |
  | DataBase: /mnt/hdb1/grassdata |
  | Title: ( eu.blue ) |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 0 |
| Data Type: CELL |
| Rows: 141970 |
| Columns: 141970 |
| Total Cells: -1319355580 |
  | Projection: Zeměpisná šířka a délka (zone 0) |
| N: 71:26:24.830769N S: 35:05:34.821226N Res: 0:00:00.92167 |
| E: 24:20:41.939214E W: 12:00:08.07033W Res: 0:00:00.921674 |
| Range of data: min = 0 max = 0 |
| |
| Data Source: |
| |
| |
| |
| Data Description: |
  | generated by r.in.gdal |
| |
| |
+----------------------------------------------------------------------------+

The red channel seems to be correct, the others contain only value
'0'. During import process the following errors occurred:

ERROR 1: IReadBlock failed at X offset 0, Y offset 141969
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 141969

I have also tried to convert ECW file to GTiff by using
gdal_translate, also without any success.

gdal_translate -of GTiff Europe\ Landsat742.ecw /mnt/hdb2/Europe\ Landsat742.tif
Input file size is 141970, 141970
0...10...20...30.ERROR 1: TryWinRasterIO() failed for blocked scanline.
ERROR 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

Any idea?, best regards

Martin

PS: The value of total cells is wrong (should not be long long int
instead of long int)? See the attached patch.

(attachments)

main.c.diff.gz (334 Bytes)

Dear Frank,

first of all, thanks a lot for quick reply.

I have tried to select a sub window from the source image. A strange
thing happen, the channels do not match. Maybe I am doing something
wrong...

gdal_translate -of GTiff -projwin 12E 52N 19E 47N Europe\
Landsat742.ecw Europe\ Landsat742.tif

or

gdal_translate -of GTiff -projwin 12 52 19 47 Europe\ Landsat742.ecw
Europe\ Landsat742.tif

The red channel covers selected region, the others are shifted..., see
the pictures bellow

http://k153-85.fsv.cvut.cz/~martin/.../ecw2tif/

2006/2/15, Frank Warmerdam <warmerdam@pobox.com>:

> The red channel seems to be correct, the others contain only value
> '0'. During import process the following errors occurred:
>
> ERROR 1: IReadBlock failed at X offset 0, Y offset 141969
> ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 141969

Martin,

I'm not sure why this is happening, though it seems most likely to
be the ECW reader failing when it starts work on the second band for
some reason.

> I have also tried to convert ECW file to GTiff by using
> gdal_translate, also without any success.
>
> gdal_translate -of GTiff Europe\ Landsat742.ecw /mnt/hdb2/Europe\ Landsat742.tif
> Input file size is 141970, 141970
> 0...10...20...30.ERROR 1: TryWinRasterIO() failed for blocked scanline.
> ERROR 1: IReadBlock failed at X offset 0, Y offset 0
> ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

A 141970 x 141970 x 3 8bit file will be circa 60GB uncompressed. TIFF
files cannot be any larger than 4GB. The error above is likely caused
by GDAL trying to write a file larger than 4GB.

Yes, you are right, I forgot that there is the limit for GTiff format.

You might want to try and translate to a format that supports large files,
like Erdas Imagine, just to verify that the GDAL ECW reading is working ok.

gdal_translate -of HFA Europe\ Landsat742.ecw /mnt/hdb2/Europe\ Landsat742.img

If that works, then we know the data is not corrupt and that GDAL can
read it.

I will try it.

Does GRASS raster format support files larger than 4GB? If not you will
either have to downsample the image, or split it into smaller tiles.

As I know GRASS raster format supports files > 4GB(?)

Best regards, Martin

On Wed, Feb 15, 2006 at 05:01:09PM +0100, Martin Landa wrote:

2006/2/15, Frank Warmerdam <warmerdam@pobox.com>:

...

> Does GRASS raster format support files larger than 4GB? If not you will
> either have to downsample the image, or split it into smaller tiles.
>

As I know GRASS raster format supports files > 4GB(?)

GRASS 6 experimentally supports large file support if enabled
during compilation. There are known issues which still need
to be fixed.

Markus

Hi Markus,

do you mean --enable-largefile?, it is enabled...

Martin

2006/2/15, Markus Neteler <neteler@itc.it>:

Martin,

do you have LFS enabled everywhere?

Markus

Martin Landa wrote:

>Hi *,
>
>I am trying to import a big (~1.7GB) ECW file downloaded from
>
> http://www.geotorrent.org/details.php?id=30
>
>I can visualize this raster map in QGIS without any problems. I would
>like to import it into a GRASS location. I have used r.in.gdal module,
>but the import was not successful. The RGB channels were generated,
>for example the green one:
>
> +----------------------------------------------------------------------------+
> | Layer: eu.blue Date: Mon Feb 13 01:31:46 2006 |
> | Mapset: PERMANENT Login of Creator: martin |
> | Location: eu_mozaika |
> | DataBase: /mnt/hdb1/grassdata |
> | Title: ( eu.blue ) |
> |----------------------------------------------------------------------------|
> | |
> | Type of Map: raster Number of Categories: 0 |
> | Data Type: CELL |
> | Rows: 141970 |
> | Columns: 141970 |
> | Total Cells: -1319355580 |
> | Projection: Zemìpisná ¹íøka a délka (zone 0) |
> | N: 71:26:24.830769N S: 35:05:34.821226N Res: 0:00:00.92167 |
> | E: 24:20:41.939214E W: 12:00:08.07033W Res: 0:00:00.921674 |
> | Range of data: min = 0 max = 0 |
> | |
> | Data Source: |
> | |
> | |
> | |
> | Data Description: |
> | generated by r.in.gdal |
> | |
> | |
> +----------------------------------------------------------------------------+
>
>The red channel seems to be correct, the others contain only value
>'0'. During import process the following errors occurred:
>
>ERROR 1: IReadBlock failed at X offset 0, Y offset 141969
>ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 141969
>
>I have also tried to convert ECW file to GTiff by using
>gdal_translate, also without any success.
>
>gdal_translate -of GTiff Europe\ Landsat742.ecw /mnt/hdb2/Europe\ Landsat742.tif
>Input file size is 141970, 141970
>0...10...20...30.ERROR 1: TryWinRasterIO() failed for blocked scanline.
>ERROR 1: IReadBlock failed at X offset 0, Y offset 0
>ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
>
>Any idea?, best regards
>
> Martin
>
>PS: The value of total cells is wrong (should not be long long int
>instead of long int)? See the attached patch.
>
>