如何从 3d 多边形制作高程模型?

How do I make an elevation model from a 3d polygon?

我有一些来自 geojson 文件的 3d 多边形,我想制作一个高程模型。这意味着我想要一个光栅,其中每个像素都是该位置多边形的高度。

我试着查看 gdal_rasterize,但描述是

As of now, only points and lines are drawn in 3D.

gdal_rasterize

我最终使用了名为 griddata 的 scipy.interpolat 函数。这里使用了meshgrid来获取网格中的坐标,由于meshgrid的内存限制,我不得不平铺它。

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

中的说明