I'm trying to read altitude GeoTIFFS from a WMS service. I know how to do this with BytesIO if the output format were a JPEG, but applying the same trick for rasterio does not seem to work. Does anyone have any suggestions?
url = 'http://geodata.nationaalgeoregister.nl/ahn3/wms?service=wms&version=1.3.0'
wms = WebMapService(url)
x1new= 51
x2new = 51.1
y1new = 5
y2new = 5.1
layer= 'ahn3_05m_dtm'
img = wms.getmap(layers = [layer], srs = 'EPSG:3857', bbox = [x1new,y1new,x2new,y2new] , size = (width,height), format= 'image/GeoTIFF')
r = rasterio.open(BytesIO(img.read()))
#this last step produces an error
r.read()
The last step hits me with an error
AttributeError: '_GeneratorContextManager' object has no attribute 'read'