I want to download a raster from a WMS server with Python and OWSLib. I have written this code from an example in a manual.
from owslib.wms import WebMapService
wms = WebMapService('http://mapy.geoportal.gov.pl:80/wss/servic/img/guest/ORTO/MapServer/WMSServer', version='1.1.1')
wms.identification.type
wms.identification.title
list(wms.contents)
wms['Raster'].title
wms['Raster'].queryable
wms['Raster'].opaque
wms['Raster'].boundingBoxWGS84
wms['Raster'].crsOptions
wms['Raster'].styles
[op.name for op in wms.operations]
wms.getOperationByName('GetMap').methods
wms.getOperationByName('GetMap').formatOptions
img = wms.getmap( layers=['Raster'],
styles=['default'],
srs='EPSG:2178',
bbox=(708542, 460329, 731172, 493289),
size=(32960, 22360),
format='image/tiff'
)
out = open('polandtest.tiff', 'wb')
out.write(img.read())
out.close()
This code returns error:
owslib.util.ServiceException: Parameter 'width' contains unacceptable value
<MaxWidth>
?