DEMADJUST

DEM adjustment to elevation points


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

Back to top

Description


Adjusts (raises/lowers) a raster DEM to elevation points held in a vector layer so that it better fits the elevation points. Typically the points are surveyed elevations or are ground control points (GCPs) and the raster DEM is one that has been generated from airphoto or satellite stereo imagery.
Back to top

Parameters


demadjust(filv, dbvs, fldnme, filedem, dbec, dboc, adjmethod)

Name Type Caption Length Value range
FILV * str Name of input file containing vector point layer 1 -    
DBVS * List[int] Adjustment elevation points 1 - 16  
FLDNME str Field name to use for elevation values 0 - 64 ZCOORD | Field Name
Default: ZCOORD
FILEDEM * str DEM file name 1 -    
DBEC * List[int] Input DEM channel. 1 - 1  
DBOC * List[int] Output raster channel containing adjusted DEM 1 - 1  
ADJMETHOD str DEM Adjustment Method 0 - 32 ALL| UNDER #.#| CLAMP #.#| UNDERSIGMA #.#| CLAMPSIGMA #.#| AVERAGEALL| AVERAGEUNDER #.#| AVERAGECLAMP #.#| AVERAGEUNDERSIGMA #.#| AVERAGECLAMPSIGMA #.#
Default: ALL

* Required parameter
Back to top

Parameter descriptions

FILV

Specifies the name of the file containing the elevation points.

DBVS

Specifies the input vector segment(s) containing points representing known elevations.

FLDNME

Specifies the field containing the elevation (or Z) values. The field name must exist in the attribute table of the vector layer(s).

Values include:
Note: Field names are not case-sensitive.

FILEDEM

Specifies the name of the file containing the raster DEM to adjust.

DBEC

Specifies the input channel containing the raster DEM to be adjusted. The channel must have the metadata tag ELEVATION_DATUM set either to mean sea level (MSL) or ellipsoidal (ELL).

DBOC

Specifies the channel to receive the adjusted DEM data.

If the output channel (DBOC) is the same as the input channel (DBEC), the input channel data is overwritten.

ADJMETHOD

Optionally specifies the adjustment algorithm that should be used. This controls which points should be used and if there should be any limits on magnitude of the adjustment that will be applied.

Available options are: For example, "CLAMP 5.0" would mean that over the entire raster DEM no adjustment more than plus or minus 5.0 would be made. The sigma method examines all the differences from the points and limits the adjustment based on the sigma value (i.e., the square root of the variance). For example "UNDERSIGMA 2.0" would only use points that are under plus or minus 2 sigma, typically meaning the 10 to 15% of the points with the largest differences would be ignored.

Each of these options can be prefaced by AVERAGE in which case the entire displacement channel is raised (or lowered) by a single value (the average difference) rather than trying to create a varying surface that goes through the points. This is useful in removing a systematic error. For example: AVERAGEALL or AVERAGEUNDERSIGMA 2.0 (which, by the way, might be a good safe option to use).

Back to top

Details

DEMADJUST adjusts (raises/lowers) a raster DEM to elevation points held in a vector layer. Typically the points are surveyed elevations or are ground control points (GCPs) and the raster DEM is one that has been generated from airphoto or satellite stereo imagery, or from SAR interferometry. Altering the raster DEM in this manner can help reduce errors in the DEM. Depending on the options used it is possible to adjust the DEM to exactly fit every point, closely match points within certain parameters, or use an average of the differences to remove a single systematic error.

DEMADJUST supports geocoded stereo DEMs and interferometric SAR DEMs in the raw (slant range) geometry. The interferometric DEMs are automatically identified by the presence of the binary math model in the input DEM file.

If adjustment is being applied to DEMs generated from stereo imagery it is HIGHLY recommended that this method only be used on raster digital terrain model (DTM) rather than the digital surface model (DSM). The DSM is the initial product produced by automatic DEM extraction and the DTM is produced either automatically (e.g., via DSM to DTM filtering) or via manual editing. In addition it is suggested that the 'flattening' of lakes and other water bodies by done after the DEM adjustment since the adjustment step will modify the entire DEM surface and large flat areas are unlikely to remain completely flat.

The vector segment/layer(s) specified in DBVS are used for the elevation points. Only points will be used - lines and polygons are ignored. To utilize lines, points and polygons in adjusting DEMs in localized regions the function RVDEMINT should be considered. Points outside the DEM area or in no data areas are ignored. The elevation is typically taken from the Z value of the points (Input vector elevation field set to "ZCOORD" or FLDNME="ZCOORD" or FLDNME="") however this can be changed by specifying the name of a numeric attribute field.

The points will automatically be reprojected to match the projection of the raster DEM. The module will terminate execution if it cannot project between the vector and DEM coordinate systems. It is the user responsibility to ensure that the raster DEM and vector points are in the same elevation units (feet or meters) and the input DEM has the ELEVATION_DATUM metadata tag set to an MSL or ELL value. The code checks for the same tag in vector layer(s); if it is not found, point elevations are assumed to be relative to the mean sea level (MSL). If the vector and DEM datums are different, the module will automatically convert points to the DEM channel elevation datum. If the datum conversion is applied, the adjusted DEM elevations at vector point locations may be different from the elevations of the points themselves.

The vector points are compared to the raster to find the difference between them. These differences are used to interpolate a 'difference surface' over the ENTIRE raster DEM, regardless of how far apart the points are. For example, if there was a single point then the entire raster DEM would be raised or lowered by the difference. This can be a dangerous operation if a point is over an error in the raster DEM (for example, the elevation point is on the top of a hill which has been mistakenly removed in the raster DEM, in which case the adjusted DEM will have a very significant error over a large area). To prevent this it is possible to limit the amount of adjustment using the Adjustment method (ADJMETHOD) parameter.

Back to top

Example

In the following example, a raster DEM has been automatically extracted and manually edited into a DTM. The resulting DTM is in channel 1 of the file DTM.pix. An older, official, survey of the area with hundreds of survey points is available in the shape file SurveyElevations.shp. The user wishes to adjust the generated raster DTM using the survey points to ensure it better fits the official survey (regardless of whether this is actually more accurate). Given some errors between the raster DTM and survey points are inevitable the adjustment method "UNDERSIGMA 2.0" is used.

from pci.demadjust import demadjust

filv	  =	"SurveyPoints.shp"      # input file
dbvs      =   [1]
fldnme    =   "ZCOORD"              # elevation in actual Z coord
filedem	  =   "DTM.pix"             # edited raster DTM
dbec      =   [1]                   # raster DTM channel
dboc      =   [1]                   # overwrite DTM with adjusted DTM
adjmethod = "UNDERSIGMA 2.0"        # ignore differences over 2.0 sigma

demadjust(filv, dbvs, fldnme, filedem, dbec, dboc, adjmethod)

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