with open(surfaceFileName,'r') as file:
data = json.load(file)
# the first feature:
dataJson = json.dumps(data['features'][0]['geometry'])
# this feature as geojson-string
featureJson = """{"type":"FeatureCollection",
"features": [
{"type": "Feature",
"geometry": """+dataJson+""",
"properties": {}
}]}"""
# Using gdal_grid:
ds2 = gdal.Grid('test10py.tif', featureJson, format = 'GTiff', algorithm = 'linear:radius=0')
这就是我解决问题的方法。这也许不是最优雅的解决方案,但似乎奏效了。 我从geojson文件(作为字典)加载曲面,获取第一个特性,然后将其转换为json字符串。在
相关问题 更多 >
编程相关推荐