3.3.5. pci.api.rasterdem module

This module has classes that represent raster digital elevation models (DEM).

class pci.api.rasterdem.RasterDEM

Bases: instance

This class can be used to obtain heights from raster digital elevation models. When required, it automatically converts heights from mean sea level to ellipsoidal or vice versa. Regardless of the internal representation in the DEM file, heights are always returned in metres.

This class cannot be created directly from python, to create a RasterDEM, call create_dem().

property background_value

The background value fo the DEM.

property cols

The number of columns in the raster file.

property crs

The 2D pci.api.cts.CRS of the raster DEM.

property crs3D

The 3D pci.api.cts.CRS of the raster DEM.

property datatype

The pci.api.gobs.DataType of the data as it is stored in the raster file.

property geocoding

The pci.api.cts.GeocodingInfo of the raster DEM.

get_height((RasterDEM)self, (float)x, (float)y) float :

Get the height (in metres)in the vertical datum specified by vdatum_out at the point x, *y in the coordinate system of the DEM.

property rows

The number of rows in the raster file.

property vdatum_out

The pci.api.cts.DatumType of the height values returned by get_height().

property vdatum_src

The pci.api.cts.DatumType of the height values as they are stored in the raster DEM file.

pci.api.rasterdem.create_dem((string_)demfile[, (uint_)chan=1[, (object)offset=None[, (object)scale=None[, (object)background_value=None[, (object)vdatum=None[, (bool)use_background_value=True[, (bool)use_cache=False[, (int_)cache_size=10]]]]]]]]) RasterDEM :

Create a RasterDEM for file demfile, using channel number chan.

The offset and scale parameters are used to compute the DEM height values, (i.e. height = scale * (dem_pixel_value + offset). If None, then the values are read from the file metadata. If these values are not stored in the file metadata, then they default to 0.0 and 1.0 respectively.

The background_value is used specify invalid pixels, if use_background_value is set to True. If None, then background_value is read from the file metadata. If it is not stored in the metadata, then it is defaulted to -32768.0.

The vdatum specifies the pci.api.cts.DatumType vertical datum of the raster DEM file. If None, then vdatum is read from the file metadata. If it is not stored in the metadata, then it is defaulted to pci.api.cts.VD_Orthometric.

If use_cache is set to True, then the returned RasterDEM will use a cache of size cache_size MB to cache raster data to minimized disk I/O.

class pci.api.rasterdem.ImageToDEM((object)self, (MathModel)model, (RasterDEM)dem)

Bases: instance

This class handles projecting from an image to a DEM. Create by specifying the pci.api.mathmodel.MathModel model, and the RasterDEM dem.

get_approx_value((ImageToDEM)self, (float)col, (float)row[, (float)start_z=0.0]) tuple :

Quickly determine the approximate location where a ray from col, row in the source image strikes the DEM. If specified, start_z represents the initial height to use to reduce the number of iterations. If successful, a three-element tuple representing the x,y,z in the math model coordinate system is return. If unsuccessful, and empty tuple is returned.

get_value((ImageToDEM)self, (float)col, (float)row) tuple :

Determine where a ray from col, row in the source image strikes the DEM. If successful, a three-element tuple representing the x,y,z in the math model coordinate system is return. If unsuccessful, and empty tuple is returned.

property height_range

A two-element tuple of the height range in the math model pci.api.cts.CRS coordinate system that defines the top & bottom of rays that are intersected with the DEM.