我正在尝试从 WMS 服务中读取海拔 GeoTIFFS。如果输出格式是 JPEG,我知道如何使用 BytesIO 执行此操作,但是对 rasterio 应用相同的技巧似乎不起作用。有没有人有什么建议?
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()
最后一步让我出错
AttributeError: '_GeneratorContextManager' object has no attribute 'read'