aws.osml.photogrammetry.digital_elevation_model module
- class aws.osml.photogrammetry.digital_elevation_model.DigitalElevationModelTileSet[source]
Bases:
ABC
This class defines an abstraction that is capable of identifying which elevation tile in a DEM contains the elevations for a given world coordinate. It is common to split a DEM with global coverage up into a collection of files with well understood coverage areas. Those files may follow a simple naming convention but could be cataloged in an external spatial index. This class abstracts those details away from the DigitalElevationModel allowing us to easily extend this design to various tile sets.
- Returns:
None
- abstract find_tile_id(geodetic_world_coordinate: GeodeticWorldCoordinate) str | None [source]
Converts the latitude, longitude of the world coordinate into a tile path.
- Parameters:
geodetic_world_coordinate – GeodeticWorldCoordinate = the world coordinate of interest
- Returns:
the tile path or None if the DEM does not have coverage for this location
- class aws.osml.photogrammetry.digital_elevation_model.DigitalElevationModelTileFactory[source]
Bases:
ABC
This class defines an abstraction that is able to load a tile and convert it to a Numpy array of elevation data along with a SensorModel that can be used to identify the grid locations associated with a latitude, longitude.
- Returns:
None
- abstract get_tile(tile_path: str) Tuple[Any | None, SensorModel | None, ElevationRegionSummary | None] [source]
Retrieve a numpy array of elevation values and a sensor model.
TODO: Replace Any with numpy.typing.ArrayLike once we move to numpy >1.20
- Parameters:
tile_path – the location of the tile to load
- Returns:
an array of elevation values, a sensor model, and a summary
- class aws.osml.photogrammetry.digital_elevation_model.DigitalElevationModel(tile_set: DigitalElevationModelTileSet, tile_factory: DigitalElevationModelTileFactory, raster_cache_size: int = 10)[source]
Bases:
ElevationModel
A Digital Elevation Model (DEM) is a representation of the topographic surface of the Earth. Theoretically these representations exclude trees, buildings, and any other surface objects but in practice elevations from those objects are likely captured by the sensors use to capture the elevation data.
These datasets are normally stored as a pre-tiled collection of images with a well established resolution and coverage.
- set_elevation(geodetic_world_coordinate: GeodeticWorldCoordinate) None [source]
This method updates the elevation component of a geodetic world coordinate to match the surface elevation at the provided latitude and longitude. Note that if the DEM does not have elevation values for this region or if there is an error loading the associated image the elevation will be unchanged.
- Parameters:
geodetic_world_coordinate – the coordinate to update
- Returns:
None
- describe_region(geodetic_world_coordinate: GeodeticWorldCoordinate) ElevationRegionSummary | None [source]
Get a summary of the region near the provided world coordinate
- Parameters:
geodetic_world_coordinate – the coordinate at the center of the region of interest
- Returns:
a summary of the elevation data in this tile
- get_interpolation_grid(tile_path: str) Tuple[RectBivariateSpline | None, SensorModel | None, ElevationRegionSummary | None] [source]
This method loads and converts an array of elevation values into a class that can interpolate values that lie between measured elevations. The sensor model is also returned to allow us to precisely identify the location in the grid of a world coordinate.
Note that the results of this method are cached by tile_id. It is very common for the set_elevation() method to be called multiple times for locations that are in a narrow region of interest. This will prevent unnecessary repeated loading of tiles.
- Parameters:
tile_path – the location of the tile to load
- Returns:
the cached interpolation object, sensor model, and summary