How To Set Up Elevation
Elevation is needed for any ossim sensor models that do earth intersects at height above the ellipsoid. Height above ellipsoid is derived from two parts, the geoid grid (vertical datum), and the height above mean sea level which usually comes from elevation cells, sometimes referred to as a digital elevation model(DEM). Elevation cells are relative to a given vertical datum. At runtime the ossimElevManager will supply sensor models with the height above ellipsoid which is "geoid_grid_point + elevation_cell_post". This happens automatically provided you have set up your ossim_preferences file correctly and have the appropriate data in you elevation repositories.
Quick setup:
This is a real preferences snip. Copy and paste to your preferences and edit paths:
elevation_manager.elevation_source0.connection_string: $(OSSIM_DATA)/elevation/dted/level2 elevation_manager.elevation_source0.enabled: true elevation_manager.elevation_source0.type: dted_directory elevation_manager.elevation_source0.min_open_cells: 25 elevation_manager.elevation_source0.max_open_cells: 50 elevation_manager.elevation_source0.memory_map_cells: false elevation_manager.elevation_source0.geoid.type: geoid1996 elevation_manager.elevation_source1.connection_string: $(OSSIM_DATA)/elevation/srtm/1arc elevation_manager.elevation_source1.enabled: true elevation_manager.elevation_source1.type: srtm_directory elevation_manager.elevation_source1.min_open_cells: 25 elevation_manager.elevation_source1.max_open_cells: 50 elevation_manager.elevation_source1.memory_map_cells: false elevation_manager.elevation_source1.geoid.type: geoid1996 elevation_manager.elevation_source2.connection_string: $(OSSIM_DATA)/elevation/dted/level1 elevation_manager.elevation_source2.enabled: true elevation_manager.elevation_source2.type: dted_directory elevation_manager.elevation_source2.min_open_cells: 25 elevation_manager.elevation_source2.max_open_cells: 50 elevation_manager.elevation_source2.memory_map_cells: false elevation_manager.elevation_source2.geoid.type: geoid1996 elevation_manager.elevation_source3.connection_string: $(OSSIM_DATA)/elevation/srtm/3arc elevation_manager.elevation_source3.enabled: true elevation_manager.elevation_source3.type: srtm_directory elevation_manager.elevation_source3.min_open_cells: 25 elevation_manager.elevation_source3.max_open_cells: 50 elevation_manager.elevation_source3.memory_map_cells: false elevation_manager.elevation_source3.geoid.type: geoid1996 // Note: Can memory map level 0 DTED safely. elevation_manager.elevation_source4.connection_string: $(OSSIM_DATA)/elevation/dted/level0 elevation_manager.elevation_source4.enabled: true elevation_manager.elevation_source4.type: dted_directory elevation_manager.elevation_source4.min_open_cells: 25 elevation_manager.elevation_source4.max_open_cells: 50 elevation_manager.elevation_source4.memory_map_cells: true elevation_manager.elevation_source4.geoid.type: geoid1996 // "image_directory" can be any type of image, i.e. tiff, nitf and so on. // elevation_manager.elevation_source5.connection_string: $(OSSIM_DATA)/elevation/some_dir // elevation_manager.elevation_source5.enabled: false // elevation_manager.elevation_source5.type: image_directory // elevation_manager.elevation_source5.min_open_cells: 25 // elevation_manager.elevation_source5.max_open_cells: 50 // elevation_manager.elevation_source5.memory_map_cells: false // elevation_manager.elevation_source5.geoid.type: geoid1996 elevation.enabled: true elevation.auto_sort.enabled: true elevation.auto_load_dted.enabled: true geoid_egm_96_grid: $(OSSIM_INSTALL_PREFIX)/share/ossim/geoids/geoid1996/egm96.grd
Detailed setup:
OSSIM Preferences File:
OSSIM can read elevation preferences from a file. With any ossim application you can use the "-P <your_ossim_prefs_file>" to point to it or you can set the environment variable "OSSIM_PREFS_FILE" to point to that file.
There is a template ossim preference file at:
http://trac.osgeo.org/ossim/browser/trunk/ossim/etc/templates/ossim_preferences_template
Note that within the preference file "//
" (two U+002F slashes) is used for ts.
1) Set up the geoid grids:
Generic support:
There is now generic geoid grid support that uses an ossim image handler to read the grid. So you can use any image provided it can be opened by ossim and a valid geometry is picked up. Example of using a raw raster file with the EGM2008 grid in it:
geoid_manager.geoid_source0.connection_string: $(OSSIM_DATA)/elevation/egm2008/Und_min1x1_egm2008_isw_equal_82_WGS84_TideFree_SE.ras geoid_manager.geoid_source0.enabled: true geoid_manager.geoid_source0.geoid.type: egm2008 geoid_manager.geoid_source0.memory_map: false geoid_manager.geoid_source0.type: geoid_image
In the above example there are three points to note.
1) There was a geometry file created for the raw raster grid.
2) The grid had a constant at the beginning and end of each row that had to be ignored with omd file.
3) Notice the "geoid.type" keyword is set to "egm2008". To map this to an elevation source1 do:
elevation_manager.elevation_source1.geoid.type: egm2008
Specific geoid grid support:
The geoid manager can handle three types of geoids. These are documented in the ossim preferences template. See below snip. At a minimum you should have the geoid_egm_96_grid which is available from the ossim svn repository at:
http://trac.osgeo.org/ossim/browser/trunk/ossim_package_support/geoids/geoid1996
// --- // Location of datum grids: // // Snip from: http://www.ngs.noaa.gov/TOOLS/Nadcon/Nadcon.html // // Advances in the accuracies now obtainable in geodetic surveys, specifically // through use of differential GPS, has allowed for the creation of state // High Precision Geodetic Networks (HPGNs), also referred to as High Accuracy // Reference Networks (HARNs) throughout the country. // --- // datum_grids: /data/ossim/elevation/nadcon-grids // --- // GEOID 99: Set keyword to the directory containing the GEOID 99 grids. // // Notes: // - Grids must be in the native byte order. // - Can be downloaded from: // http://www.ngs.noaa.gov/GEOID/GEOID99 // --- geoid_99_directory: /data/image_formats/elevation/geoid99_little_endian // --- // GEOID EGM 96: Set keyword to the path to the egm96.grd // // Notes: // - Grid must be in BIG ENDIAN (UNIX) format. // - Can be downloaded from: // http://earth-info.nima.mil/GandG/wgs84/gravitymod/egm96/ww15mgh.grd.z // - The grid is part of an install; hence, the OSSIM_INSTALL_PREFIX use. // --- geoid_egm_96_grid: $(OSSIM_INSTALL_PREFIX)/share/ossim/geoids/geoid1996/egm96.grd // ---
2) Set up the elevation cells:
The elevation manager can handle three types of elevation cells, Digital Terrain Elevation Data(DTED), Shuttle Radar Topographic Mission(SRTM) and General Raster. These can be of varying resolution. Typically elevation cells placed in a directory are all the same type/resolution. In other words all the DTED level 2 in one directory all the srtm 1 arc second in another directory and so on. Multiple directories are allowed.
NOTE: Always put your highest resolution directories first.
Directories are set in the preferences file. This is a snip from the template:
// --- // Keyword pair: // elevation_source.type // elevation_source.filename // // Indicates an elevation source. These should be listed in pairs. Numbering // should start with 1 with lowest number being the highest resolution. This // can be a cell(file) or a directory. // // There are four elevation_source.type types: // elevation_source.type: dted_cell // elevation_source.type: srtm_cell // elevation_source.type: dted_directory // elevation_source.type: srtm_directory // elevation_source.type: general_raster_directory // // The elevation_source.filename keyword should point to a cell or a directory. // // NOTES: // The elevation_source keyword replaces the deprecated keywords: // dted_directory // srtm_directory // dted_cell // // Examples: //--- elevation_source1.filename: /images/elevation/srtm/1arc elevation_source1.type: srtm_directory elevation_source2.filename: /images/elevation/dted/3arc elevation_source2.type: dted_directory elevation_source3.filename: /images/elevation/dted/1arc/w090/n40.dt1 elevation_source3.type: dted_cell elevation_source4.filename: /images/elevation/srtm/1arc/N40W092.hgt elevation_source4.type: srtm_cell elevation_source4.filename: /images/elevation/srtm/half_arc_raster elevation_source4.type: general_raster_directory
Miscellaneous keywords:
// --- // Keyword: default_elevation_path // Default path for the elevation manager popup "Add" to start at. default_elevation_path: /images/elevation/srtm/1arc // --- // --- // Keyword: elevation.enabled // If disabled calls to the elevation manager getHeightAboveMSL and // getHeightAboveEllipsoid will return a null height. (default=true) // Use: "true", "yes", "y" or "1" to enable, // "false", "no", "n" or "0" to disable. elevation.enabled: true // --- // --- // Keyword: elevation.auto_load_dted.enabled // Enable autoloading of dted elevation as need from above directories. // (default=true) // Use: "true", "yes", "y" or "1" to enable, // "false", "no", "n" or "0" to disable. elevation.auto_load_dted.enabled: true // --- // --- // Keyword: elevation.auto_sort.enabled // Enable sorting of elevation cells on an add by the lowest(best) mean post // spacing. (default=true) // Use: "true", "yes", "y" or "1" to enable, // "false", "no", "n" or "0" to disable. elevation.auto_sort.enabled: true // --- // --- // Keyword: elevation.compute_statistics.enabled // // Enable computations of min and max height of each elevation cell. This // will force a write of a statistics file if one does not exists. If disabled // and the statistics file is not present the min and max value will be // undefined. Typically if you are doing mosaics of elevation you would want // this on. If you don't want a pause computing stats like in a 3d viewer // you would want this off. (default=true) // // Use: "true", "yes", "y" or "1" to enable, // "false", "no", "n" or "0" to disable. elevation.compute_statistics.enabled: true // --- //--- // Defines the number of instances of elevation databases to maintain for multi-threading. // Can be boolean "yes" or "true" to use all available cores, or an integer value for // custom experimentation. Set to "no", "false", or 1 for no multi-threading. Default // is "true". //--- elevation_manager.threads: true
Testing your elevation:
You should NEVER see nan's in imagelinker or ossimplanet. A "nan" is "Not A Number". To test the elevation use ossim-info --height. Usage is ossim-info --height <latitude> <longitude>. Example:
ossim-info --height 27.84 -80.48 Opened cell: /data2/elevation/srtm/1arc/N27W081.hgt MSL to ellipsoid delta: -29.5178591613769 Height above MSL: 11.0000000000573 Height above ellipsoid: -18.5178591613196 Geoid value: -27.9172229766846
Some useful links:
Elevation manager:
http://trac.osgeo.org/ossim/doxygen/classossimElevManager.html
Geoid manager:
http://trac.osgeo.org/ossim/doxygen/classossimGeoidManager.html
USGS srtm:
http://dds.cr.usgs.gov/srtm/version2_1/
Geoid:
http://trac.osgeo.org/ossim/browser/trunk/ossim_package_support/geoids/geoid1996
Quickbird Imagery:
http://download.osgeo.org/ossim/tutorials/pdfs/qb_ortho_ossim_2011.pdf