[GRASS5] i.rectify and large files

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all!

I'm having trouble with the i.rectify and my (quite large) TIFF image. when I run i.rectify it stops with
ERROR: error while writing to temp file

I added some debug messages and see that it fails because the temp file is larger then 2 GB. I reconfigured GRASS with both --enable-largefile and
- --enable-64bit, but no help. Looking more closely at i.rectify I see that it uses open(temp_name, 0) to open the temp file. Okay so the problem is probably here, on line 56 in file write.c of i.rectify. I tried to add the O_LARGEFILE flag, but now it doesn't get compiled as I'm not able to convince the compiler that I want to have large file support for this code as well. What can I do? Is there perhaps some GRASS lib function to open possibly large files?

- --Wolf

- --

<:3 )---- Wolf Bergenheim ----( 8:>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFENiVg7wAiM835oB0RApqeAJ9RxGQvNkUA/1ZvwEBkkDjn4g5YbACgrKty
wJRc//cd8qMILfZuAON+Cjk=
=0iRu
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Calmly replying to myself.

All I had to do was add
#define _FILE_OFFSET_BITS 64
to the beginning of the file. Now it seems to work. This is probably not the best way to do it, so if someone can tell me the correct way to do this, I will fix it, and then commit changes to the CVS (time I contributed something back again).

- --Wolf

On Fri, 7 Apr 2006, Wolf Bergenheim wrote:

Hi all!

I'm having trouble with the i.rectify and my (quite large) TIFF image.
when I run i.rectify it stops with
ERROR: error while writing to temp file

I added some debug messages and see that it fails because the temp file is
larger then 2 GB. I reconfigured GRASS with both --enable-largefile and
--enable-64bit, but no help. Looking more closely at i.rectify I see that
it uses open(temp_name, 0) to open the temp file. Okay so the problem is
probably here, on line 56 in file write.c of i.rectify. I tried to add the
O_LARGEFILE flag, but now it doesn't get compiled as I'm not able to
convince the compiler that I want to have large file support for this code
as well. What can I do? Is there perhaps some GRASS lib function to open
possibly large files?

--Wolf

--

<: 3 )---- Wolf Bergenheim ----( 8:>

- --

<:3 )---- Wolf Bergenheim ----( 8:>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFENizw7wAiM835oB0RAt9EAKCbPbhuJWWAb534PeQGZeCfrxRfCwCfamQU
G+0evRtnCGr0jKx3IafiH7A=
=jlSR
-----END PGP SIGNATURE-----

Wolf Bergenheim wrote:

All I had to do was add
#define _FILE_OFFSET_BITS 64
to the beginning of the file. Now it seems to work. This is probably not
the best way to do it, so if someone can tell me the correct way to do
this, I will fix it, and then commit changes to the CVS (time I
contributed something back again).

Try the attached patch.

--
Glynn Clements <glynn@gclements.plus.com>

(attachments)

i.rectify.patch (992 Bytes)

> I'm having trouble with the i.rectify and my (quite large) TIFF
> image. when I run i.rectify it stops with
> ERROR: error while writing to temp file
>
> I added some debug messages and see that it fails because the temp
> file is larger then 2 GB. I reconfigured GRASS with both
> --enable-largefile and --enable-64bit, but no help. Looking more
> closely at i.rectify I see that it uses open(temp_name, 0) to open
> the temp file. Okay so the problem is probably here, on line 56 in
> file write.c of i.rectify. I tried to add the O_LARGEFILE flag, but
> now it doesn't get compiled as I'm not able to convince the compiler
> that I want to have large file support for this code as well. What
> can I do? Is there perhaps some GRASS lib function to open possibly
> large files?

..

Calmly replying to myself.

All I had to do was add
#define _FILE_OFFSET_BITS 64
to the beginning of the file. Now it seems to work. This is probably
not the best way to do it, so if someone can tell me the correct way
to do this, I will fix it, and then commit changes to the CVS (time I

contributed something back again).

Another "get the job done" approach is to use a script that adds GCPs
from the POINTS file to the TIFF via gdal_translate and then rectify
with gdalwarp.

See attached script for hints.

Hamish

(attachments)

i.warp61 (3.22 KB)