X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



2857 Rate this article:
No rating

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
Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »