[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing geotiffs with IDL



Hi John,
I have written an application that processes our ADAR1000 digital camera
sysem images - it interpolates the raw Kodak DCS460 data, performs a
vignette correction to correct for the lens falloff, performs a BRDF
correction and finally links in the GPS data. The GPS data gives location in
WGS84 latitude and longitude although I convert this to WGS84 UTM (called
'easting', 'northing' and 'zone' below). The elevation data is used to
derive the Pixel size (called 'gre' below). I derive a heading from the GPS
data and use the negative of this as the angle through which the image must
be rotated to align north south (called 'rotangle' below). The user can do
one of two things, either chose that the image be rotated north-south (I use
ROT after putting the image into a larger array), or leaving the image as it
is and defining a transformation matrix in the GeoTiff Tags.
Here is a subset of the code:

if transformNS eq 'Yes' then begin

    ; Snip
    ; outputimage is rotated using rotangle to grid North-South here !
    ; Snip

    ; Create the GeoTiff Structure for the North-South data

geo=create_struct('MODELTIEPOINTTAG',[bboxx,bboxy,0D,easting,northing,0D])
    geo=create_struct(geo,'MODELPIXELSCALETAG',[gre,gre,0])

endif else begin

    ; Create a the model transformation matrix
    ; Note Image size is 3064*2040 pixels so the diagonal is 1840.5 pixels

    trans=[[cos(rotangle)*gre,sin(rotangle)*gre,0,$
    easting-(1840.5*gre*cos(rotangle-imgangle))],$
    [sin(rotangle)*gre,-cos(rotangle)*gre,0,$
    northing-(1840.5*gre*sin(rotangle-imgangle))],$
    [0,0,0,0],[0,0,0,1D]]

    ; Create the GeoTiff Structure for the unrotated data
    geo=create_struct('MODELTRANSFORMATIONTAG',trans)

endelse

; Put a bit more info into the geotiff structure here
geo=create_struct(geo,'GTRASTERTYPEGEOKEY',1)
geo=create_struct(geo,'GTMODELTYPEGEOKEY',1)
geo=create_struct(geo,'PROJECTEDCSTYPEGEOKEY',32700+zone)

; Write the geotiff file
write_tiff, filename, outputimage, GEOTIFF=geo


Its all a little messy since it's one of those jobs that just grew, but it
works a treat. Just remember to use the correct variable type. Note that the
model transformation tag is not baseline geotiff, so some platforms will not
support it (like Arcview). However the latest versions of ENVI and ERDAS
Imagine seem to like it. I got all the tag information from:
http://www.remotesensing.org/geotiff/spec/contents.html

Let me know how you go,

Peter Scarth
--
Biophysical Remote Sensing Group
Department of Geographical Sciences & Planning
University of Queensland
Brisbane, Queensland, AUSTRALIA, 4072
Ph: 61-7-33656534 Fax: 61-7-33656899



"John Brock" <jbrock@cfcg.er.usgs.gov> wrote in message
3ADF5DF8.6FF82BD0@cfcg.er.usgs.gov">news:3ADF5DF8.6FF82BD0@cfcg.er.usgs.gov...
> Does anyone have an example IDL procedure that writes geotiff files?  We
> are trying
> to figure out how to define the numerous geotiff tags for lidar-based
> elevation images,
> and have not been able to find an example.
>
> Thanks for any help,
>
> John Brock
>