comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Get Latitude and Longitude from Tiff files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Get Latitude and Longitude from Tiff files [message #54771 is a reply to message #54546] Tue, 03 July 2007 20:08 Go to previous messageGo to previous message
Lucia is currently offline  Lucia
Messages: 5
Registered: June 2007
Junior Member
According to David Fanning's instruction, I have found a method that
can obtain latitude and longitude of each of point of GeoTIFF.
The source code is as follows.

pro get_latlon
filename='F:\data\A2007098.0235\mod43.Albedo_BSA_Band1.tif'

image = Read_Tiff(filename, GEOTIFF=geotag) ; GeoTIFF info in
"geotag" structure.
image = Reverse(image, 2) / 10000 ; Reverse Y direction, divide by
10000 to give correct values

; Find the image dimensions. Will need later.
s = Size(image, /Dimensions)
UTM_Map = MAP_PROJ_INIT('UTM', CENTER_LAT=0.0,
CENTER_LON=0.0,ZONE=50,datum=8,/gctp)
; Calculate corner points from GeoTIFF structure obtained from file.
xscale = geotag.ModelPixelScaleTag[0]
yscale = geotag.ModelPixelScaleTag[1]
tp = geotag.ModelTiePointTag

xOrigin = tp[3]
yOrigin = tp[4]

lon=fltarr(s[0])
lat=fltarr(s[1])
lat[0]=xorigin
lon[0]=yorigin

for i=1,s[0]-1 do begin
lon[i]=xorigin+xscale*i
endfor

for i=1,s[1]-1 do begin
lat[i]=yorigin-yscale*i
endfor

lat=transpose(lat)
lat=rebin(lat,s[0],s[1],/sample)
lon=rebin(lon,s[0],s[1],/sample)
latitude=fltarr(s[0],s[1])
longitude=fltarr(s[0],s[1])

for i=0,s[0]-1 do begin
lat1=lat[i,*]
lon1=lon[i,*]
a = MAP_PROJ_INVERSE(lon1,lat1,map_structure=UTM_Map)
longitude[i,*]=a[0,*]
latitude[i,*]=a[1,*]
endfor

filename='F:\data\A2007098.0235\latitude.dat'
openw,lun,filename,/get_lun
writeu,lun,latitude
free_lun,lun
filename='F:\data\A2007098.0235\longitude.dat'
openw,lun,filename,/get_lun
writeu,lun,longitude
free_lun,lun

end

^v^
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL ION
Next Topic: Re: how to use Mosaic_doit procedure

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 13:45:44 PDT 2025

Total time taken to generate the page: 0.32340 seconds