RSGISLib WMTS Tools
- rsgislib.tools.wmts_tools.get_wmts_layer_list(wmts_url: str, name_filter: str = None) List[str]
A function which uses the owslib module to retrieve the list of available layers from a WMTS service.
- Parameters:
wmts_url – the URL for the WMTS service.
name_filter – an optional layer name filter the filter has to be found within the layer name using the ‘in’ operator (e.g., layers with ‘visual’ in layer_name)
- Returns:
list of layers names
- rsgislib.tools.wmts_tools.get_wmts_as_img(wmts_url: str, wmts_lyr: str, bbox: List[float], bbox_epsg: int, output_img: str, gdalformat='GTIFF', zoom_level: int = None, tmp_dir: str = None, wmts_epsg: int = None)
A function which retrieves an image (e.g., GTIFF) from a WMTS for a specified region of interest. Be care to ask for large areas at high zoom levels!
Note, gdal will cache tiles which will be saved to a default path which can be defined using the GDAL_DEFAULT_WMS_CACHE_PATH variable.
- Parameters:
wmts_url – The url for the WMTS service
wmts_lyr – the layer within the WMTS to use
bbox – the bounding bbox for the region of interest [MinX, MaxX, MinY, MaxY]
bbox_epsg – the EPSG code of the inputted bbox.
output_img – the output image file path.
gdalformat – the output image format.
zoom_level – Optionally, the zoom level to be outputted.
tmp_dir – Optionally, a temporary directory for some intermediate files. If not specified, a tmp dir is created and removed in the local path from where the script is run from.
wmts_epsg – Provide the epsg code for the WMTS layer (probably 3857) if the code can’t automatically find it.