environmentaltools.spatiotemporal.raster.obtain_geometry
- environmentaltools.spatiotemporal.raster.obtain_geometry(contour, info)[source]
Convert a contour represented by pixel indices to a real-world geometry.
Maps a sequence of (row, col) pixel indices from a raster contour to real-world coordinates using the x and y coordinate arrays provided in the info dictionary. Returns a LineString geometry representing the contour in spatial coordinates.
- Parameters:
contour (np.ndarray) – Array of shape (N, 2) containing (row, col) pixel indices of the contour.
info (dict) – Configuration dictionary containing coordinate arrays under info[‘coords’][‘x’] and info[‘coords’][‘y’].
- Returns:
geom – LineString geometry representing the contour in real-world coordinates.
- Return type:
shapely.geometry.LineString