open_raster
Luo_Suppe2026-08-15
gma.gio.open_raster
[function] open_raster(in_src, name_or_id = 0, allowed_drivers = [], open_options = [], sibling_files = []):Open a raster or vector file as a Dataset.
Parameters:
in_src: str.
Name of the file to open.
Optional:
name_or_id = int||str. Default 0.
Dataset id or name in the GeoDatabase to get.
allowed_drivers = list. Default [].
A list of the names of drivers that may attempt to open.
open_options = dict/list. Default [].
A dict or list of name=value driver-specific opening options.
sibling_files = list. Default [].
A list of filenames that are auxiliary to the main filename.
Returns:
Type: Dataset.
Example
from gma import gio
ds = gio.open_raster('HYP_50M_SR_W.tif') # Natural Earth shaded relief
print(type(ds).__name__, ds.shape, ds.dtype)
print('bounds:', tuple(round(v, 2) for v in ds.bounds))
print('crs :', ds.crs)
Dataset (3, 5400, 10800) Byte
bounds: (-180.0, -90.0, 180.0, 90.0)
crs : <CoordinateReferenceSystem:WGS 84>