Hi,
i have with envi. i try to convert the lat/lon coordinates to Pixel
values, but my results are negative and big.
this is my program:
the number of samples are 36800 and the number of lines are 57600.
Pro news, ego
filename = envi_pickfile(title = 'DeMarine-DEKO')
if(filename eq '')then return
envi_open_file, filename, r_fid=De_fid
envi_file_query, De_fid, ns=ns, nl=nl, nb=nb, pos=pos,$
dims=dims, data_type=type, sname=sname
dims = [-1L, 0, ns-1, 0, nl-1]
pos = lindgen(nb)
map_info = envi_get_map_info(fid =De_fid)
print, map_info
proj_u = map_info.proj; Auszug Projektion von Struktur $ MAP
proj_dd = envi_proj_create(/geographic);Projektion fuer lat/lon
Daten
proj_aa = envi_proj_create(/utm, zone= 37, /south, datum=8,
units=meters )
xf = [0, ns-1]
yf = [0, nl-1]
; Establish file coordinate system
fwest_p=1; NW corner of file is 0,0
fnorth_p=1; NW corner of file is 0,0
feast_p=fwest_p+ns
fsouth_p=fnorth_p+nl
; Establish map coordinate system
fxcent_p=map_info.mc[0]; UTM coordinates defined from center
fycent_p=map_info.mc[1]; UTM coordinates def. from center
fxcent_u=map_info.mc[2]
fycent_u=map_info.mc[3]
xpxsz_u=map_info.ps[0]
ypxsz_u=map_info.ps[1]
fwest_u=fxcent_u+(long(fwest_p-fxcent_p)*xpxsz_u)
feast_u=fxcent_u+(long(feast_p-fxcent_p)*xpxsz_u)
fnorth_u=fycent_u+(long(fycent_p-fnorth_p)*ypxsz_u)
fsouth_u=fycent_u+(long(fycent_p-fsouth_p)*ypxsz_u)
print, 'fxcent_p:',fxcent_p ; the result is 0.00000000
print, 'fycent_p:',fycent_p ; the result is 0.00000000
print, 'fxcent_u:',fxcent_u ; the result is 296999.38
print, 'fycent_u:',fycent_u ; the result is 5039000.6
print, 'fwest_u:',fwest_u ; the result is 297000.63
print, 'feast_u:',feast_u ; the result is 343000.63
print, 'fnorth_u:',fnorth_u ;---------------is
5038999.4
print, 'fsouth_u:',fsouth_u ;---------------is 4966999.4
;convert map coordinate boundaries to DD
envi_convert_projection_coordinates,[fxcent_u,feast_u,fxcent _u,
feast_u], $
[fsouth_u,fsouth_u,fycent_u,fycent_u],proj_aa,fcornerx_dd,fc ornery_dd,proj_dd
print,fcornerx_dd ; the latitude is :36.405251
36.992822 36.434432 37.015407
print,fcornery_dd ; the longitude is :-45.423007
-45.434850 -44.775521 -44.787101
envi_convert_file_coordinates, De_fid, xmap, ymap, fcornery_dd,
fcornerx_dd
print, xmap ;-237635.84 -237635.85 -237635.32
-237635.33
print, ymap ;4031171.4 4031170.9 4031171.4
4031170.9
i think xmap and ymap are false, but i don't where is the error.
my intention is to convert to pixel values.
please, can somebody help me.
thanks
end
|