How to use IDL to read a large file of Geotif format and then write to a new geotif-format file? [message #57714] |
Mon, 17 December 2007 22:19  |
chenshengbj
Messages: 1 Registered: December 2007
|
Junior Member |
|
|
Hello,everyone,
this is my first time to post my question in the forum. As a
beginner in learning IDL, I found a difficulty in reading a large file
and write into a new file.My work is to read large file whose size if
about 10 GB. Will anyone tell me how to read a large file of Geotif
format and then write to a new geotif-format file with the projection
and coordination information from the sourc file?
|
|
|
Re: How to use IDL to read a large file of Geotif format and then write to a new geotif-format file? [message #57786 is a reply to message #57714] |
Fri, 28 December 2007 22:24  |
KRDean
Messages: 69 Registered: July 2006
|
Member |
|
|
10 Gb is pretty big. In fact, this is too big for a GeoTIFF. The
biggest a GeoTIFF can get is 4.7 Gb. That is because the offset to the
first IFD in the TIFF file is an unsign long.
Your GeoTIFF is most likely a 1 Gb. From experience, IDL produces a
core dump when you try to read a GeoTIFF over 2.0 Gb.
This is what I do to read a large GeoTIFF ( 1Gb or larger) with IDL.
(see code at end). To write a smaller section as a GeoTIFF, refer to
the IDL Help. It provides a nice discussion about preparing the
GeoTIFF tags for output.
Kelly Dean
Fort Collins, CO
;+
;
;
;----------------------------------------------------------- -----------
;
PRO PrintTags, stc, Verbose=Verbose
tags = TAG_NAMES( stc )
ntags = N_TAGS( stc )
FOR i = 0, ntags-1 DO BEGIN
PRINT, ' Print Tags -- ', tags[i], ' Value -- : ', stc.(i)
ENDFOR
END
;+
;
; @examples
; <PRE>
; TIFFsaw, 'C:\Data\Boulder\05JUL04180116-
P2AS-005554445180_01_P001.TIF'
; </PRE>
;
;----------------------------------------------------------- -----------
PRO TIFFsaw, file, Verbose=Verbose
IF ( FILE_TEST( file ) ) THEN BEGIN
IF ( QUERY_TIFF( file, info, GEOTIFF=geoinfo ) ) THEN BEGIN
IF ( KEYWORD_SET( Verbose ) ) THEN PrintTags, info, Verbose =
Verbose
IF ( KEYWORD_SET( Verbose ) ) THEN PrintTags, geoinfo, Verbose =
Verbose
startCol = 0UL
startRow = 0UL
rows = 1000UL
cols = info.dimensions[0]
nchop = info.dimensions[1] / rows
FOR i = 0, nchop-1 DO BEGIN
subRect = [ startCol, startRow, cols, rows ]
imgchop = READ_TIFF( file, SUB_RECT = subRect )
; startCol = startCol
startRow = startRow + rows
title = STRING( subRect, FORMAT='( "IDL chop : ", 4( 1X,
I0) )' )
WINDOW, 0, XSIZE=cols, YSIZE=rows, TITLE=title
TVscl, imgChop, /Order
ENDFOR
ENDIF ELSE BEGIN
IF ( KEYWORD_SET( Verbose ) ) THEN MESSAGE, /CONT, ' -- File is
not a TIFF : ' + file
ENDELSE
ENDIF ELSE BEGIN
IF ( KEYWORD_SET( Verbose ) ) THEN MESSAGE, /CONT, ' -- File not
found : ' + file
ENDELSE
END
On Dec 17, 11:19 pm, chenshen...@gmail.com wrote:
> Hello,everyone,
> this is my first time to post my question in the forum. As a
> beginner in learning IDL, I found a difficulty in reading a large file
> and write into a new file.My work is to read large file whose size if
> about 10 GB. Will anyone tell me how to read a large file of Geotif
> format and then write to a new geotif-format file with the projection
> and coordination information from the sourc file?
|
|
|