gemgis.web.load_as_map
gemgis.web.load_as_map#
- gemgis.web.load_as_map(url: str, layer: str, style: str, crs: Union[str, dict], bbox: List[Union[int, float]], size: List[int], filetype: str, transparent: bool = True, save_image: bool = False, path: str = None, overwrite_file: bool = False, create_directory: bool = False)#
Loading a portion of a WMS as array
- Parameters
url (str) – Link of the WMS Service, e.g.
url='https://ows.terrestris.de/osm/service?'
layer (str) – Name of layer to be requested, e.g.
layer='OSM-WMS'
style (str) – Name of style of the layer, e.g.
style='default'
crs (str) – String or dict containing the CRS, e.g.
crs='EPSG:4647'
bbox (List[Union[float,int]]) – List of bounding box coordinates, e.g.
bbox=[0, 972, 0, 1069]
size (List[int]) – List of x and y values defining the size of the image, e.g.
size=[1000,1000]
filetype (str) – String of the image type to be downloaded, e.g.
filetype='image/png'
transparent (bool) – Variable if layer is transparent. Options include:
True
orFalse
, default set toTrue
save_image (bool) – Variable to save image. Options include:
True
orFalse
, default set toFalse
path (str) – Path and file name of the file to be saved, e.g.
path=map.tif
overwrite_file (bool) – Variable to overwrite an already existing file. Options include:
True
orFalse
, default set toFalse
create_directory (bool) – Variable to create a new directory of directory does not exist Options include:
True
orFalse
, default set toFalse
- Returns
wms_map – OWSlib map object
- Return type
owslib.util.ResponseWrapper
New in version 1.0.x.
Example
>>> # Loading Libraries and WMS Service as Map >>> import gemgis as gg >>> wms_map = gg.web.load_as_map(url='https://ows.terrestris.de/osm/service?', layer='OSM-WMS', style='default', crs='EPSG:4647', bbox=[32286000,32328000, 5620000,5648000], size=[4200, 2800], filetype='image/png') >>> wms_map <owslib.util.ResponseWrapper at 0x261d348cc10>
See also
load_wms
Load WMS Service
load_as_array
Load Map as array from WMS Service