X
76 Rate this article:
No rating

INTERNAL: An ENVI User Function for finding a UTM zone by latitude and longitude

Anonym
In ENVI, the map projection conversion tools contain a feature which allows a user to determine a UTM zone by specifying the latitude and longitude of the area. However, this tool is inaccessible from anywhere except inside the map projection conversion tools. This user function creates an interface which calculates the appropriate UTM zone based upon user-specified latitude / longitude coordinates. Additionally, it adds a routine, GET_UTM_ZONE_DOIT, which can then be accessed programmatically.
 
This user function is in a compiled .sav format. It can be used in either full ENVI (i.e. ENVI + IDL) or ENVI RT (ENVI Runtime). It was built and compiled in ENVI 3.5 / IDL 5.5 and is not backwards compatible.

Be sure to place the .sav file for this function in the save_add directory of your ENVI installation structure.


To add this user function to your installation of ENVI


Click
here to download the ENVI 3.5 save file get_utm_zone.sav. For more details on how to add this function to ENVI please see How to Add a User Function to ENVI. A good location for adding a button (perhaps named "Find UTM Zone") for accessing this function is under the Basic Tools -> General Purpose Utilities section of the ENVI main menu.

Once the code and menu button have been added to ENVI, you should be able to access the tool, which should look like:


To call this utility in ENVI programming


Use the following function and syntax:


GET_UTM_ZONE_DOIT


This procedure is used to find the UTM zone for a given point specified by latitude / longitude coordinates.


Calling Sequence


GET_UTM_ZONE_DOIT,
lat, lon

Arguments

lat

The latitude, in decimal degrees, of the point for which the UTM zone is to be calculated.

lon

The longitude, in decimal degrees, of the point for which the UTM zone is to be calculated.

Keywords

ZONE

Use this keyword to specify a named variable to contain the calculated UTM zone.

SOUTH

Use this keyword to specify a named variable to contain a value designating North or South zones. A 1 is returned if the zone is South. A 0 is returned if the zone is North.

Example

This example calculates the UTM zone for the point 39.98 North, 105.0 West. The zone is returned in the variable utm_zone, and the flag for the hemisphere is returned in the variable south_flag. The result is printed to the output log.

lat = 39.98

lon = -105.0

get_utm_zone_doit, lat, lon, zone=utm_zone, south=south_flag


if (south eq 1) then hemi = 'South'

if (south eq 0) then hemi = 'North'

result = 'The point ' + string(lat) + ' ,' + string(lon) + ' is in UTM zone ' + string(utm_zone) + hemi + '.'


print, result



DISCLAIMER


This additional functionality is provided free of charge as a service for our ENVI users; however, this procedure is not supported by Research Systems Technical Support. The procedure get_utm_zone.sav has been been tested and we believe that it works correctly, but it is in no way guaranteed.