ENVI Classic: Sample program that outputs selected map info stucture tags
There are times when a user finds the need to access the map information structure of a specific file. This can be done by issuing various commands at the ENVI command input prompt and then checking the output log. Another more simplified method would involve using the following program to display some of the desired information via a GUI.
Note: - An interactive ENVI session is required to run this routine.
- The exact structure variables may change in future versions of ENVI.
Several options are available to run this program. It can be run in the ENVI/IDL development environment or it can be placed within ENVI's main menubar. Here are the steps required to use the program from the command line:
1) Copy and paste the program into a new file in the development environment.
2) Save the file and then compile it from the menubar.
3) Run the program.
; This is a small program that outputs some of the
; tags derived from the ENVI_MAP_INFO_STRUCT
; structure of a chosen file. The choice of those
; outputs can be set according to the users needs.
pro map_info_output
compile_opt strictarr
;Select an input file, if none chosen return
envi_select, fid=fid, title='Please select a file to open'
if (fid eq -1L) then return
;Get the associated map information structure
map = envi_get_map_info(fid=fid)
proj_info= envi_get_projection(fid=fid)
;Set up variables with standard structure tags used for widget
;Extras can be added to the output as necessary
proj= map.proj
mc= map.mc
ps= map.ps
rotation= map.rotation
pseudo= map.pseudo
kx= map.kx
ky= map.ky
best_root= map.best_root
o_rpc= map.o_rpc
;Convert some variables from integer value
;to text
zone=fix(map.proj.params[0])
units=map.proj.units
unit= envi_translate_projection_units(units)
;Setup info for output
line1 = 'MC: ' + string(mc[2]) + string(mc[3])
line2 = 'Rotation: ' + string(rotation)
line3 = 'KX: '
line4 = string(kx[0,0]) + ' ' + string(kx[1,0])
line5 = string(kx[0,1]) + ' ' + string(kx[1,1])
line6 = 'KY: '
line7 = string(ky[0,0]) + ' ' + string(ky[1,0])
line8 = string(ky[0,1]) + ' ' + string(ky[1,1])
line9 = 'Pixel size: '+ string(ps[0]) + string(ps[1])
line10 = 'Units: ' + unit
;Put all the lines together for output
prompt1= [line1,line2,line3,line4,line5, $
line6, line7, line8, line9, line10]
;Widget construction
base= widget_auto_base(title='Map Info Output')
wsl1= widget_slabel(base, prompt= [prompt1], /frame)
wm= widget_map(base, default_map=[mc[2],mc[3]], $
default_proj=proj, uvalue='uvalue', /auto)
; If 'Cancel' then return
result = auto_wid_mng(base)
if (result.accept eq 0) then return
END