如何从三维多边形创建立面模型?

2024-04-25 12:33:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个geojson文件的三维多边形,我想做一个高程模型。这意味着我需要一个光栅,其中每个像素都是这个位置上多边形的高度。在

我试着看了看格达尔•乌光栅化,但描述上说

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

gdal_rasterize


Tags: and文件of模型only高度as光栅
1条回答
网友
1楼 · 发布于 2024-04-25 12:33:21

最后我用了scipy.interpolate-函数名为griddata。这使用一个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上的说明

相关问题 更多 >