python - 如何从 3D 多边形制作高程模型?

标签 python gdal polygons rasterizing

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

我尝试查看 gdal_rasterize,但描述显示

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

gdal_rasterize

最佳答案

我最终使用了名为 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/

相关文章:

android maps v2 多边形透明度

java - 如何从构造函数中获取 JPanel 的宽度和高度?

apache-spark - PySpark 和栅格 (GeoTiff) 数据

Python:SQLAlchemy ImportError:没有名为 pysqlite2 的模块

python os.listdir 遇到 OSError : [Errno 13] Permission denied

python - python 中的基本递归遇到问题

c++ - 如何将提取的栅格信息转换为opencv库可处理的格式

c++ - 写大口角图片

math - 裁剪两个 2D 三角形

python - 计算数组中的邻居值