我有来自 geojson 文件的许多 3d 多边形,我想制作一个高程模型。这意味着我想要一个栅格,其中每个像素都是该位置的多边形的高度。
我尝试查看 gdal_rasterize,但描述显示
As of now, only points and lines are drawn in 3D.
最佳答案
我最终使用了名为 griddata 的 scipy.interpolat 函数。这使用了网格网格来获取网格中的坐标,由于网格网格的内存限制,我不得不将其平铺。
import scipy.interpolate as il #for griddata
# meshgrid of coords in this tile
gridX, gridY = np.meshgrid(xi[c*tcols:(c+1)*tcols], yi[r*trows:(r+1)*trows][::-1])
## Creating the DEM in this tile
zi = il.griddata((coordsT[0], coordsT[1]), coordsT[2], (gridX, gridY),method='linear',fill_value = nodata) # fill_value to prevent NaN at polygon outline
线性插值似乎完全符合我的要求。请参阅https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html处的描述
关于python - 如何从 3D 多边形制作高程模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40397477/