In [117]:
from owslib.wms import WebMapService
wms = WebMapService('http://mapy.geoportal.gov.pl/wss/service/img/guest/ORTO/MapServer/WMSServer', version='1.1.1')

In [118]:
wms.identification.type


Out[118]:
'OGC:WMS'

In [119]:
wms.identification.title


Out[119]:
'Usługa przeglądania (WMS) ortofotomap dla obszaru Polski'

In [120]:
list(wms.contents)


Out[120]:
['Raster']

In [121]:
wms['Raster'].title


Out[121]:
'Raster'

In [122]:
wms['Raster'].title


Out[122]:
'Raster'

In [123]:
wms['Raster'].queryable


Out[123]:
1

In [124]:
wms['Raster'].opaque


Out[124]:
0

In [125]:
wms['Raster'].boundingBox


Out[125]:
(14.0, 48.901811, 24.759301, 54.925806, 'EPSG:4326')

In [126]:
wms['Raster'].boundingBoxWGS84


Out[126]:
(14.0, 48.901811, 24.759301, 54.925806)

In [127]:
wms['Raster'].crsOptions


Out[127]:
['EPSG:2180',
 'EPSG:2177',
 'EPSG:2176',
 'EPSG:2179',
 'EPSG:4326',
 'EPSG:3857',
 'EPSG:2178']

In [128]:
wms['Raster'].styles


Out[128]:
{'default': {'legend': 'http://mapy.geoportal.gov.pl/wss/service/img/guest/ORTO/MapServer/WmsServer?request=GetLegendGraphic%26version=1.1.1%26format=image/png%26layer=Raster',
  'title': 'Raster'}}

In [141]:
bbox=( 20+29/60+28/3600,53+46/60+55/3600,20+30/60+13/3600, 53+47/60+10/3600)
print (bbox)


(20.491111111111113, 53.78194444444444, 20.503611111111113, 53.78611111111111)

In [148]:
img = wms.getmap(layers=['Raster'],styles=['default'],srs='EPSG:4326',
bbox=bbox,
size=(300, 250),
format='image/jpeg',
transparent=True
)

In [149]:
import matplotlib.pyplot as plt

In [150]:
a=img.read()

In [151]:
out = open('tmp.jpg', 'wb')
out.write(img.read())
out.close()

In [152]:
import matplotlib.image as mpimg
fig, ax = plt.subplots(figsize=(20, 10))
img=mpimg.imread('tmp.jpg')
imgplot = plt.imshow(img)
plt.show()