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.



7124 Rate this article:
No rating

How to use a projection type that the ESRI Projection Engine supports but ENVI does not

As of ENVI 4.7, all calculations involving map projections in ENVI are handled using the powerful ESRI Projection Engine. This is true for all ENVI products, including ENVI, ENVI+IDL, ENVI Zoom and ENVI Ex. Previous versions of ENVI used the General Cartographic Transformation Package (GCTP). While much of ENVI's map projection functionality will remain unchanged to users, the switch will result in some differences when working with map projections in ENVI 4.7 and later versions.

This Help Article provides information on different ways to use a projection type that is supported in the ESRI Projection Engine but does not show up in the list of projections available in ENVI.

Reading from an ESRI Geodatabase file

The most straight-forward way to get ENVI to recognize a projection that is supported by the ESRI Projection Engine but not available in the ENVI Projection selection dialog is to read the file from an ESRI Geodatabase. When an image or vector layer is read directly from an ESRI geodatabase, ENVI will import the projection type codes and apply them to the file. All subsequent processing done on the file will inherit these projection codes as well. To open a file from a geodatabase in ENVI you will need to use the Remote Connection Manager under the Window menu. Then select Connection ->New... and connect to a File, Personal or Enterprise geodatabase. Once connected, all files will be shown in the Remote Connection Manager.


The Remote Connection Manager in ENVI 4.7


When you open the file in ENVI, the image and projection can be displayed in the Available Bands List.


The Available Bands List with an ESRI GRID file in the Krovak projection.


However, this does not update the ENVI Map Projection selection dialog. Currently, this dialog cannot be updated with projections that are supported in the ESRI Projection Engine but not in ENVI.


Adding an ESRI projection to an ENVI file manually

In the case that your image is in a projection supported by the ESRI Projection Engine but not available in ENVI, and your file is not in a geodatabase, you can manually edit the ENVI Header file to add in the appropriate projection string. If no map information is present in your file you will first need to set up a projection using the Edit ENVI Header ->Map Info dialog. Be sure to set the correct tie point, map coordinate for the tie point, and pixel size in this dialog. The projection type selected is less important because ENVI will use the ESRI coordinate system string information along with the tie point and pixel information from Map Info to report the correct projection information. However it may be easier if you select a projection that is similar to the ESRI projection you intend to use. Once you have defined this information in the Map Info dialog, save and close the ENVI header dialog.

Next, find the correct GEOGCS or PROJCS projection string you need to apply to your data. (Refer to
Tech Tip 4455 for links to the predefined GEOGCS and PROJCS coordinate system strings). Copy this projection string.

Open the ENVI header associated with your image file using a text editor. At the bottom of the header file, type:
coordinate system string =

Then paste in the projection string at the equals "=" sign as below:

coordinate system string ={PROJCS["NAD_1983_HARN_StatePlane_Colorado_Central_FIPS_0502",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",914401.8289],PARAMETER["False_Northing",304800.6096],PARAMETER["Central_Meridian",-105.5],PARAMETER["Standard_Parallel_1",38.45],PARAMETER["Standard_Parallel_2",39.75],PARAMETER["Latitude_Of_Origin",37.83333333333334],UNIT["Meter",1.0]]}

Make sure there is a single carriage return after the last line in your header file. Your ENVI header file should look similar to the following:

ENVI
samples = 1937
lines = 1695
bands = 3
header offset = 0
file type = ENVI Standard
data type = 4
interleave = bsq
sensor type = Unknown
byte order = 0
map info = {State Plane (NAD 27), 1.0000, 1.0000, -597336.7838, 471466.6151, 1.5000000000e+001, 1.5000000000e+001, 502, units=Meters}
coordinate system string = {PROJCS["NAD_1983_HARN_StatePlane_Colorado_Central_FIPS_0502",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",914401.8289],PARAMETER["False_Northing",304800.6096],PARAMETER["Central_Meridian",-105.5],PARAMETER["Standard_Parallel_1",38.45],PARAMETER["Standard_Parallel_2",39.75],PARAMETER["Latitude_Of_Origin",37.83333333333334],UNIT["Meter",1.0]]}


Save the text file with this information. Now, open your image in ENVI. You should see a Map Info icon for your image which should contain the new ESRI map projection string or datum.


Converting and ENVI file to an ESRI projection programmatically

In order to convert a file in an ENVI supported projection to a projection that is not available in the ENVI dialog but supported by the ESRI Projection Engine, you will need to use ENVI's projection routines programmatically. These include the ENVI routines ENVI_PROJ_CREATE and ENVI_CONVERT_FILE_MAP_PROJECTION described below.

In ENVI 4.7, the ENVI_PROJ_CREATE routine now supports new fields and keywords for specifying geographic (GEOGCS) or projected (PROJCS) coordinate system codes and strings. See the ENVI Map Projections help for more details.

The code sample below shows how you can convert a dataset in UTM to an ESRI projection that is not available in the list of ENVI projections. 
 (Refer to Tech Tip 4455 for links to the predefined GEOGCS and PROJCS coordinate system strings).


Convert to ESRI projection dialog



The projected file is displayed in the Available Bands List.


The Available Bands List with image converted to the Harn datum.



Example:
pro test_envi_convert_file_to_new_map_projection
  compile_opt idl2

  ; paths to input and output files
  inputFN = 'C:\Program Files\ITT\IDL71\products\envidata\qb_boulder_msi'
  outputFN = 'C:\temp\qb_boulder_msi_proj_converted.img'
 
  ; Open the input file to convert to the new map projection 
  envi_open_file, inputFN, r_fid=fid 
  if (fid eq -1) then begin 
    return 
  endif 
 
  ; open the input file and get some properties
  envi_file_query, fid, dims=image_dims, nb=nb 
   
  ; define bands and pixel size to use during convert
  band_array   = lindgen(nb) 

  ; Refer to Tech Tip 4455 for a listing of all the 
  ; predefined GEOGCS and PROJCS coordinate systems.
  ; note envi_proj_create() can also take a predefined 
  ; or custom geogcs/projcs string via the PE_COORD_SYS_STR keyword

  ; here is a projcs codes that is supported in envi4.7 but not accessible from the envi dialog
  ; 2773 PROJCS["NAD_1983_HARN_StatePlane_Colorado_Central_FIPS_0502]

  peCoordSysCode = 2773    
  o_proj = envi_proj_create(type=42, PE_COORD_SYS_CODE=peCoordSysCode)
  
  ; convert the input file to the new proj and write out the new file
  envi_convert_file_map_projection, fid=fid, $ 
                                    pos=band_array, $
                                    dims=image_dims, $
                                    o_proj=o_proj, $ 
                                    grid=[50,50], $ 
                                    out_name=outputFN, $
                                    warp_method=0, $ 
                                    resampling=1, $
                                    background=0 
end 

 

Review on 12/31/2013 MM

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 »