1
使用rasterio获取单个点的像素值
要使用rasterio在栅格中的某个点上获得单个像素值,请参见此处的示例:https : //github.com/mapbox/rasterio/pull/275 但是,在rasterio(而不是cli)中是否有直接API可用于在栅格中的单个点提取值? -编辑 with rasterio.drivers(): # Read raster bands directly to Numpy arrays. # with rasterio.open('C:\\Users\\rit\\38ERP.tif') as src: x = (src.bounds.left + src.bounds.right) / 2.0 y = (src.bounds.bottom + src.bounds.top) / 2.0 vals = src.sample((x, y)) for val in vals: print list(val)