pub struct GeoGrid {
pub origin: GeoCoord,
pub rows: usize,
pub cols: usize,
pub cell_width: f64,
pub cell_height: f64,
pub rotation: f64,
pub altitude_mode: AltitudeMode,
}Expand description
A georeferenced regular grid anchored to a geographic origin.
Cell (0, 0) is the north-west corner. Row index increases
southward, column index increases eastward. All dimensions are in
meters.
Fields§
§origin: GeoCoordGeographic origin (north-west corner of cell (0, 0)).
rows: usizeNumber of rows (south-ward).
cols: usizeNumber of columns (east-ward).
cell_width: f64Cell width in meters (east-west extent per cell).
cell_height: f64Cell height in meters (north-south extent per cell).
rotation: f64Grid rotation in radians (clockwise from north). Default 0.0.
altitude_mode: AltitudeModeAltitude mode for the grid surface.
Implementations§
Source§impl GeoGrid
impl GeoGrid
Sourcepub fn new(
origin: GeoCoord,
rows: usize,
cols: usize,
cell_width: f64,
cell_height: f64,
) -> Self
pub fn new( origin: GeoCoord, rows: usize, cols: usize, cell_width: f64, cell_height: f64, ) -> Self
Create a new grid with the given dimensions and cell size.
origin is the north-west corner. cell_width and cell_height
are in meters.
Sourcepub fn cell_count(&self) -> usize
pub fn cell_count(&self) -> usize
Total number of cells.
Sourcepub fn cell_center(&self, row: usize, col: usize) -> Option<GeoCoord>
pub fn cell_center(&self, row: usize, col: usize) -> Option<GeoCoord>
Geographic coordinate of the centre of cell (row, col).
Returns None if row >= rows or col >= cols.
Sourcepub fn geo_bounds(&self) -> (GeoCoord, GeoCoord)
pub fn geo_bounds(&self) -> (GeoCoord, GeoCoord)
Geographic bounding box of the grid (north-west, south-east).