GEOCODEDEM

Geocode DEM from epipolar DEM


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Return Value :: Details :: Example :: References :: Related

Back to top

Description


GEOCODEDEM geocodes epipolar or InSAR digital elevation models (DEMs) by reprojecting to the specified ground coordinate system.
Back to top

Parameters


geocodedem(mfile, dbec, dbscore, dbiw, failvalu, backelev, demedit, demclip, filo, elevref, elevunit, mapunits, upleft, loright, pxszout, mergeopt, memsize)

Name Type Caption Length Value range
MFILE* str Input file name, directory, or text file 1 -  
DBEC List[int] Input epipolar DEM channel 0 - 1  
DBSCORE List[int] Input correlation score channel 0 - 1  
DBIW List[int] Raster input window 0 - 4 Xoffset, Yoffset, Xsize, Ysize
FAILVALU List[float] DEM extraction failure value 0 - 1 Default: -100
BACKELEV List[float] Background value 0 - 1  
DEMEDIT str Edit DEM 0 - 3 YES | NO
Default: YES
DEMCLIP str DEM Clip 0 - 16
FILO* str Output geocoded DEM file 1 -    
ELEVREF str Vertical reference for elevation values 0 -   MSL | ELLIPS
ELEVUNIT str Elevation value units 0 - 7 METER | FEET | US_FEET
Default: METER
MAPUNITS str Output projection units 0 -   Default: None
UPLEFT List[float] Output image upper-left coordinate 0 - 2  
LORIGHT List[float] Output image lower-right coordinate 0 - 2  
PXSZOUT List[float] Output pixel size 0 - 2  
MERGEOPT str DEM merge option 0 - 7 LAST | AVERAGE | SCORE | BLEND
Default: BLEND
MEMSIZE List[int] Working memory size 0 - 1 Default: 2000

* Required parameter
Back to top

Parameter descriptions

MFILE

Specifies the name of a folder, image file, or text file that contains the input epipolar or interferometric SAR (InSAR) DEM images to be processed. Wildcards (*) can be used.

MFILE can be set using any of the following options:
If the text file option is used, the following general rules apply:

DBEC

Optionally specifies the input channel that contains the digital elevation model (DEM) to be extracted.

If this parameter is not specified, the function automatically searches the image, DEM, and, optionally, the correlation score (DBSCORE) channels from the input file. By default, the function will geocode the second channel in the input file.

DBSCORE

Specifies the channel that contains the correlation score. It is not used for the interferometric SAR DEMs.

DBIW

Specifies the raster window, in pixel and line coordinates, that is read from the input epipolar images. If this parameter is not specified, the entire layer is used by default.

Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

If UPLEFT (Upper Left Coordinate) and LORIGHT (Lower Right Coordinate) are specified, this parameter is ignored.

FAILVALU

Specifies the value given to pixels for which the generation of elevation values failed. This value should be outside the range of valid elevation values. The failure value identifies the areas that can be interpolated and filled.

BACKELEV

Optionally specifies the background elevation value of the input and output DEM.

When the empty DEM file is first created, the function fills the entire DEM channel with the specified background elevation value. In the final DEM file, this value indicates areas that have no stereo images from which to extract elevation values.

Select a value that is different from the Elevation Failure Value (FAILVALU) and that is not a valid extracted elevation value for the area. For example, setting this parameter to 0 in a coastal area is a poor choice because a valid extracted elevation can match this value. If the FAILVALU and the NO_DATA_VALUE/BACKELEV value are the same then the algorithm will exit with an error.

If this parameter is not specified, the function checks for ELEVATION_BACKGROUND or NO_DATA_VALUE metadata tags, first at the channel level, then at the file level. If this value is not specified or found in the metadata, the function uses the default value of -32768.

If this parameter is specified and the NO_DATA_VALUE metadata tag is found in the input file then the algorithm will exit with an error. Overridding the NO_DATA_VALUE with this parameter can cause errors that are hard to diagnose. To fix the error do one of the following:
  1. Modify the NO_DATA_VALUE value in the input file. If the NO_DATA_VALUE is wrong then choose this option.
  2. Leave the BACKELEV parameter blank. If the NO_DATA_VALUE is correct then choose this option.
  3. Set the BACKELEV to the same value as the NO_DATA_VALUE. This is an alternative to solution 2.

DEMEDIT

Specifies whether to automatically edit the DEM.

Supported options are:

DEMCLIP

Specifies the amount of data to be clipped from the epipolar DEMs before merging and geocoding them. This functionality is possible only when FILEDEM is specified..

This parameter specifies the amount of the actual image data that is clipped, either as a number of pixels or, if specified, as a percentage of the image size.

Two values can be entered:

For example, if a value of 5,10 is entered, five pixels are clipped from the left and right edges, while ten pixels are clipped from the top and bottom edges.

If a single value is specified and the value is positive, clipping is applied to all edges of the image; for example, if the specified value is 5, five pixels are clipped from all four edges.

To clip based on a percentage of the image size, enter the % symbol after the value: for example, if a value of 5%,7% is entered, five percent is clipped from the left and right edges and seven percent from the top and bottom edges.

In some cases it is better to clip the output geocoded image based on the height computed from DEM world. This is because the extracted DEM may contain large elevation errors due to noise (such as water). If a negative %value is entered such as -10%, the geocoded extent would not exceed the extent computed using DEM world plus 10% on each side.

The default is blank, which means no clipping occurs. The maximum percentage value is 49%.

FILO

Specifies the name of the generated geocoded digital elevation model (DEM) file.

ELEVREF

The vertical reference for the elevation values in the generated geocoded DEM. If not specified, the value will be read from the epipolar DEM and the math model.

Acceptable values are as follows:

ELEVUNIT

The units of the elevation values that are stored as pixel values in the generated geocoded DEM.

Acceptable values are as follows:

If you specify the elevation values as FEET, the conversion factor to meters is 0.3048 (corresponding to International Feet); if you specify US_FEET, the conversion factor is 1200/3937 (corresponding to U.S. Survey Feet).

If you do not specify a value for this parameter, the value of the ELEVATION_UNITS metadata tag of the DEM channel specified by DBEC is used. If the tag does not exist in the DEM, the default value is used.

MAPUNITS

Specifies the projection string for the output DEM. If not specified, the map units are determined automatically.

The standard definitions are as follows:

If METER or FEET is specified, the math model and DEM must be METER or FEET.

If a regular, Earth-referenced projection is specified, the math model and DEM must also use a regular projection (not necessarily the same one); METER and FEET are not allowed.

The label of a user-defined projection may also be specified, if the projection exists in the userproj.txt file. Otherwise the projection parameter information must be provided as a string separated by the vetical bar ('|'). The projection parameter string defines 18 parameters delimited by spaces, including Dearth, RefLong, RefLat, StdParallel1, StdParallel2, FalseEasting, FalseNorthing, Scale, Height, Long1, Lat1, Long2, Lat2, Azimuth, LandsatNum, LandsatPath and UnitsCode. For instance, the projection named 'France93' may be specified as:
LCC D350 | 0 0 3.0 46.5 44.0 49.0 700000 6600000 0 0 0 0 0 0 0 0 0 -1

This parameter can specify the UTM grid zone number and row, and Earth model, as follows:

UTM [mm] [r] [Ennn]

where:

The Earth model can be specified for LONG/LAT (and other units except METER or FEET), as follows:

LONG/LAT [Ennn]

This parameter can specify the SPCS zone number and Earth model as follows:

SPCS [mmmm] [Ennn]

where [mmmm] is is the four-digit zone number.

If the Earth model is not specified, it is assumed to be E000 (Clarke 1866).

If MAPUNITS is not specified, the logic for determining a default ortho coordinate system is as follows:

UPLEFT

Optionally specifies the upper-left ground X and Y coordinates, in map units, for the output geocoded DEMs.

If this parameter is not specified, GEOCODEDEM calculates and uses the upper-left corner coordinate from the input DEM file.

LORIGHT

Optionally specifies the lower-right ground X and Y coordinate, in map units, for the output geocoded DEMs.

If this parameter is not specified, GEOCODEDEM calculates and uses the lower-right corner coordinate from the input DEM file.

PXSZOUT

Optionally specifies the resolution of the generated pixels. If this parameter is not specified, the resolution is automatically determined from the input epipolar DEM files.

The units of this parameter must be the same as the units of the math models used to generate the epipolar DEM. For images using the RPC math model, this is generally LONG/LAT; for most other math models, it is a projected coordinate system in meters or feet.

If multiple epipolar DEMs are provided, the first DEM processed is used to determine the units and resolution.

MERGEOPT

Optionally specifies the DEM merging option to use when multiple epipolar DEMs are geocoded and added to the output DEM file.

When a new geocoded DEM is added to the file and it overlaps an existing geocoded DEM, you must specify the method by which to determine the pixel value to use.

Valid methods are:

MEMSIZE

The amount, in megabytes (MB), of internal memory to allocate to processing.

Back to top

Return Value

Returns: execution status

Type:  PCI_INT

The return value is 0. This function returns only if it executes successfully; otherwise, it throws an exception.

Back to top

Details

Geocoding reprojects the epipolar digital elevation model (DEM) to the ground coordinate system at a given ground resolution. This component uses a set of epipolar DEMs, geocodes them, and then merges them into one file. Alternatively, it can process one or more interferometric SAR (InSAR) DEMS in the raw SAR image geometry, and with rational function math model. The InSAR DEMs have no score channel, and no SAR image is expected in the input DEM file.

Back to top

Example

Geocode epipolar DEM file S188_S189_DEM.pix and place the generated geocoded DEM into a PCIDSK file name "geocoded_DEM.pix".

from pci.geocodedem import *

mfile = r"C:\demo\airphoto\S188_S189_DEM.pix"    # file to process
dbec = [1]              # epipolar DEM channel
dbscore = [2]               # correlation score channel
dbiw = [3000,3000,1000,1000]        # input window offset 3000, size 1000
failvalu = [-100]           # if DEM cannot be extract, use elevation value of -100
backelev = [-150]           # background value
demedit = "NO"              # do not fill holes
demclip = ''                # do not clip DEM
filo = r"C:\demo\geocoded_DEM.pix"   # output file
elevref = "MSL"             # elevation reference
elevunit = "METER"          # elevation unit
mapunits = "utm 11 d0"          # output DEM file map units
upleft = []             # upper-left coordinate of geocoded DEM
loright = []                # lower-right coordinate of geocoded DEM
pxszout = [1.2,1.2]         # pixel/line resolution 1.2 meters
mergeopt = "AVERAGE"            # use AVERAGE to replace pixel values in overlap areas
memsize  = []               # Working memory size

geocodedem( mfile, dbec, dbscore, dbiw, failvalu,
            backelev, demedit, demclip, filo, elevref, elevunit,
            mapunits, upleft, loright, pxszout, mergeopt, memsize )
Back to top

References

DEM Geocoding Module Refactor Report. PCI Report.

© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.