Function lupnt::LoadTiff

Function Documentation

std::tuple<MatXd, MatXd, MatXd> lupnt::LoadTiff(std::filesystem::path path, std::array<double, 2> xlims, std::array<double, 2> ylims, double max_res)

Load a TIFF file and return the data, x coordinates, and y coordinates.

Load a (possibly cropped and downsampled) digital elevation model from a GeoTIFF file via GDAL.

Used by surface/rover environment and dynamics models to obtain lunar terrain elevation data over a region of interest for terrain-relative navigation and surface dynamics. Opens path with GDAL, intersects the requested x/y bounding box with the raster’s extent, downsamples (nearest-neighbor) so the output grid spacing does not exceed max_res, and returns the cropped/downsampled elevation grid together with its x/y coordinate grids.

Parameters:
  • tif_path – Path to the TIFF file

  • xlims – X limits in m

  • ylims – Y limits in m

  • max_res – Maximum resolution in m

  • path – Path to the GeoTIFF (DEM) file to load.

  • xlims – Desired x-coordinate (e.g. easting) bounds [min, max] in the raster’s coordinate units (m), intersected with the raster’s actual extent.

  • ylims – Desired y-coordinate (e.g. northing) bounds [min, max] in the raster’s coordinate units (m), intersected with the raster’s actual extent.

  • max_res – Maximum output grid spacing [m]; the raster is downsampled by an integer factor so neither axis’ spacing exceeds this value.

Returns:

Tuple containing the data, x coordinates, and y coordinates as Eigen matrices

Returns:

Tuple of (x_coords, y_coords, data): pixel-center x and y coordinate grids [m] and the corresponding elevation/raster values, all as matrices of shape (out_height, out_width).