VDEMSETUP

Prepare output DEM files for VDEMINT


EnvironmentsPYTHON :: EASI
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Related

Back to top

Description


VDEMSETUP creates an index file that contains a list of raster-DEM files to generate with VDEMINT. You use VDEMSETUP with VDEMINGEST and VDEMINT.
Back to top

Parameters


vdemsetup(filv, indexfil, demtype, mapunits, dempxsz, demtile, elevunit, backelev, elevref)

Name Type Caption Length Value range
FILV * str Name of the input vector file 1 -    
INDEXFIL * str Name of the index file 1 -    
DEMTYPE * str Format of the DEM file 1 - 5 PIX | TIF | JP2
MAPUNITS str Map-projection units 0 -    
DEMPXSZ * List[float] DEM resolution 1 - 2  
DEMTILE List[int] DEM tile dimensions (pixels, lines) 0 -    
ELEVUNIT str Units of the elevation value 0 - 7 METER | FEET | US_FEET | DEFAULT
BACKELEV List[float] Value of the background elevation 0 -    
ELEVREF str Vertical reference for elevation values 0 -   MSL | ELLIPS | MATHMODEL

* Required parameter
Back to top

Parameter descriptions

FILV

The name of the input PCIDSK (.pix) file that contains points, breaklines, and other vector information to use to generate a raster DEM. Typically, you use VDEMINGEST to generate the the input file.

INDEXFIL

The name of the index text file to create as output. The output file will contain information that defines each required raster DEM file (tile). This text file is read by VDEMINT to create the raster DEM files.

The file you specify must not exist and the file name must have a .txt file name extension. For more information on the format of the DEM-index file, follow the link to ORTHO under Related functions at the end of this topic.

DEMTYPE

The format of the output DEM files for VDEMINT to create.

You can choose from the following options:

Although all versions of the JPEG2000 compression lose some accuracy, it is usually minor. JPEG2000 compressed files can be 10 to 100 times smaller than the corresponding PIX or TIF files, depending on the option used: A, B, or C.

MAPUNITS

The output projection for the DEM.

If no value is specified for this parameter, the output projection defaults to that of the input file.

This parameter is optional.

DEMPXSZ

The x and y resolution of the DEM to produce. When you specify a single value, it is used for both x and y.

With LAT/LONG projections, the unit is DEGREES. With State Plane projections, the unit is FEET; for all other projections, the unit is METERS.

DEMTILE

The size of the output DEM file (tile), in pixels and lines.

The value you specify creates a sequence of files that cover the entire DEM extent. The files are created using the name of the provided in the input vector file, with the suffixes _0_0, _0_1, _1_1, and so on to indicate the row and column number of the tile.

When you specify a single value, it is used for both pixels and lines.

If no value is specified for this parameter, a single DEM file is created that is big enough to cover the entire DEM extent.

Tiles must be at least 1,000 pixels by 1,000 lines in size.

This parameter is optional.

ELEVUNIT

The units of the elevation.

Acceptable values are:

If no value is specified for this parameter, or when the DEFAULT value is specified, the elevation units are transferred from the input file.

FEET is defined as 0.3048 meters (corresponding to International Feet); US_FEET is defined as 1200/3937 meters (corresponding to U.S. Survey Feet).

BACKELEV

The value of the background elevation (NoData) in the input elevation channel.

If no value is specified for this parameter, VDEMSETUP checks for ELEVATION_BACKGROUND or NO_DATA_VALUE metadata tags, first at the channel level, and then at the file level. If the value is neither specified nor found in the metadata, the default value of -32768 is applied.

This parameter is optional.

ELEVREF

The vertical reference for the elevation values in the source DEM, or for the constant ELFACTOR value, if it is used.

Acceptable values are:
Back to top

Details

VDEMSETUP creates an index file in text format (.txt), which describes the DEM files to generate with VDEMINT.

When you want to generate a raster DEM from vector information, such as points, breaklines, and contours, there are three functions you use typically:
  • VDEMINGEST: reads (ingests) the vector information and stores it in a standard format in a PCIDSK file
  • VDEMSETUP: uses the output of VDEMINGEST with additional information you provide to create an index file specifying the layout, resolution, and format of the raster-DEM files to create
  • VDEMINT: uses the vector output of VDEMINGEST and the index file created by VDEMSETUP to create the required DEM files and interpolates the raster DEM

The following example shows an index file generated by VDEMSETUP for six tiles:

MAPUNITS   SPAF 4100   D-02
DATATYPE   32R
DBEC       1
BACKELEV   -32768.000000
ELEVREF    MATHMODEL
ELEVUNIT   FEET
ELFACTOR   0.000000 1.000000
RES_XY     2.000000 2.000000
#Filename   ULX   ULY   LRX  LRY
index_0_0.pix   1687702.000000 758178.000000 1691702.000000 754178.000000
index_0_1.pix   1691702.000000 758178.000000 1695702.000000 754178.000000
index_1_0.pix   1687702.000000 754178.000000 1691702.000000 750178.000000
index_1_1.pix   1691702.000000 754178.000000 1695702.000000 750178.000000
index_2_0.pix   1687702.000000 750178.000000 1691702.000000 746178.000000
index_2_1.pix   1691702.000000 750178.000000 1695702.000000 746178.000000
  • MAPUNITS is taken from the MAPUNITS parameter, if specified, or from the units in FILV, if unspecified
  • DATATYPE is derived from the DEMTYPE parameter. 32R is used for PIX and TIF files, 16S for JP2
  • DBEC is always one, because files generated by VDEMINT contain only one elevation channel
  • ELEVREF is copied directly from the ELEVREF parameter
  • ELEVUNIT is copied directly from the ELEVUNIT parameter, if specified; otherwise, the elevation unit from FILV or METER is used, by default
  • ELFACTOR the values of elevation scaling and offset are determined automatically. These are described in more detail, later in this topic.
  • REX_XY pixel resolution of the DEM is copied directly from the DEMPXSZ parameter
  • file name and extents the file name of DEM tiles is derived from the name of the index file, the row and column number of the tile, and the format of the file as specified for the DEMTYPE parameter (.pix, .tif or .jp2). The total extents are based on the overall file extents from the input vector file. The individual tile extents are derived from the size of the raster pixels and lines of the DEMTILE parameter multiplied by the pixel resolution of the DEMPXSZ parameter.

For more information on the format of the DEM-index file, follow the link to ORTHO under Related functions at the end of this topic.

Notes on JPEG2000 compression

If you specify the value of the DEMTYPE parameter as JP2, the DEM-raster files generated by VDEMINT will be compressed, often by a factor of 50 to 100. Not only is the JPEG2000 compression 'lossy', but it must be stored in 16-bit format, so that the vertical resolution of the elevation data is also scaled to the nearest centimeter (or inch) increment that will fit into a 16-bit range. In practice, the lossy compression and loss of vertical resolution is unnoticeable in the final orthorectified products.

VDEMSETUP automatically determines the vertical resolution based on several factors, including the total elevation range of the data and the pixel resolution of the raster DEM. Using the entry "ELFACTOR OFFSET, SCALE" in the index file, the actual elevation (in the unit specified for the ELEVUNIT parameter) can be computed from the 16-bit digital values stored in the raster DEM as:

elevation_value = scale * (DEM_pixel_value + offset)
Back to top

Examples

You have elevation points in x, y, and z format text files, and breaklines in ESRI shapefiles. A raster DEM at a resolution of 8 meters, in a TIF file, is the objective. To accomplish this, three steps are required:
  • Ingest the vector data with VDEMINGEST
  • Define the required raster DEM required with VDEMSETUP
  • Create the DEM file and interpolate the raster DEM from the vector data with VDEMINT
from pci.vdemingest import vdemingest
from pci.vdemsetup import vdemsetup
from pci.vdemint import vdemint

POINTS   = "points/*.txt"                 # x, y, and z points in text file
CONTOURS = ""                             # no contours
BREAKLIN = "breaklines/*.shp"             # shapefile breaklines
STRUCT3D = ""                             # no 3-D structure
ELEVOPTS = ""                             # no special options
ELEVRANG = []                             # accept all elevations
RIDGES   = ""                             # no ridges
VALLEYS  = ""                             # no valleys
CLIFFS   = ""                             # no cliffs
FILV     = "vector.pix"                   # output vector file
MAPUNITS = ""                             # default, projection from first file
ELEVUNIT = "METER"                        # input points and breaklines in meters
ELEVCONV = []                             # no conversion (data already in meters)

# ingest vector data
vdemingest( POINTS, CONTOURS, BREAKLIN, STRUCT3D, ELEVOPTS, ELEVRANG, RIDGES, VALLEYS, CLIFFS, FILV, MAPUNITS, ELEVUNIT, ELEVCONV )

FILV     = "vector.pix"
INDEXFIL = "dem/index.txt"                # index.txt and DEMs in folder dem
DEMTYPE  = "PIX"                          # PCIDSK 32-bit real output file for DEMs
MAPUNITS = ""                             # default projection to that of FILV
DEMPXSZ  = [8,8]                          # output resolution of 8 meters in x,y for DEM data
DEMTILE  = []                             # single DEM file (index.pix) covering entire extent
ELEVUNIT = "METER"                        # no change
BACKELEV =  []                            # default, -32,768
ELEVREF  = "MATHMODEL"                    # DEM will be used with airphotos

# create index.txt file ready for VDEMINT
vdemsetup( FILV, INDEXFIL, DEMTYPE, MAPUNITS, DEMPXSZ, DEMTILE, ELEVUNIT, BACKELEV, ELEVREF )

FILE   = "dem/index.txt"
DBOC   = [1]                              # index file contain only one channel
DBOW   = []                               # generate entire DEM
FILV   = "vector.pix"                     # from VDEMINGEST
DBVS   = []                               # automatically find vector segments
VECTYP = []                               # automatically determine vector types
FLDNME = ""                               # no attributes
MAXITER= [20]                             # maximum of 20 smoothing iterations
MEMSIZE= [2000]                           # use 2,000 MB (2 GB) of memory

# create the raster DEM (named index.pix)
vdemint( FILE, DBOC, DBOW, FILV, DBVS, VECTYP, FLDNME, MAXITER, MEMSIZE )

In the preceding example, points and breakline vector data were ingested and stored in the file vector.pix and a raster DEM with a resolution of 8 meters created by VDEMINT. Examining the DEM, you realize that it should have been a DEM with a resolution of 2 meters; however, a DEM at a resolution of 2 meters will be 16 times the data volume, and a single DEM file will be many gigabytes. You decide to divide the DEM into 'tiles', each tile being a file 5,000 pixels by 5,000 lines (10 km x 10 km in extent), and use JPEG2000 compression on each tile to minimize the usage on disk.

You decide to put the tiles in a new folder named demjp2 on Drive D and use a Windows utility to create the folder.

Your first step is to use VDEMSETUP to create an index file describing the tiles you want, and then use VDEMINT to create the JPEG2000-compressed DEM tiles.

from pci.vdemsetup import vdemsetup
from pci.vdemint import vdemint

FILV     = "vector.pix"
INDEXFIL = "demjp2/index.txt"             # index.txt and DEMs in folder demjp2
DEMTYPE  = "JP2"                          # JPEG2000-compression format, default compression
MAPUNITS = ""                             # default projection to that of FILV
DEMPXSZ  = [2,2]                          # output resolution of 2 meters in x,y for DEM data
DEMTILE  = [5000,5000]                    # DEM tiles each 5,000 pixels x 5,000 lines
ELEVUNIT = "DEFAULT"                      # Elevation units from vector.pix
BACKELEV = []                             # default, -32,768
ELEVREF  = "MATHMODEL"                    # DEM will be used with airphotos

# create index.txt file ready for VDEMINT
vdemsetup( FILV, INDEXFIL, DEMTYPE, MAPUNITS, DEMPXSZ, DEMTILE, ELEVUNIT, BACKELEV, ELEVREF )

FILE   = "demjp2/index.txt"
DBOC   = [1]                              # output DEM in channel 1
DBOW   = []                               # generate entire DEM coverage
FILV   = "vector.pix"                     # from VDEMINGEST
DBVS   = []                               # automatically find vector segments
VECTYP = []                               # automatically determine vector types
FLDNME = ""                               # no attributes
MAXITER= [20]                             # maximum of 20 smoothing iterations
MEMSIZE= [2000]                           # use 2,000 MB (2 GB) of memory

# create DEM tiles (index_0_0.jp2, index_0_1.jp2, ...)
vdemint( FILE, DBOC, DBOW, FILV, DBVS, VECTYP, FLDNME, MAXITER, MEMSIZE )

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