Products
GG网络技术分享 2025-11-13 22:28 5
珠穆朗玛峰及其周围地区Zui高大点的功Neng。
读取GeoTIFF文件用rasterio库读取GeoTIFF文件,并将其转换为NumPy数组。

计算Zui高大点用NumPy库找到高大程数组中的Zui巨大值及其索引。
获取经纬度坐标用GeoTIFF的元数据将索引转换为对应的经纬度坐标。
可视化用matplotlib和GeoJSON.io可视化后来啊,并在地图上标记Zui高大点。
下面是完整的Python代码实现:
python import rasterio import numpy as np import matplotlib.pyplot as plt from shapely.geometry import Point
def read_geotiff: with rasterio.open as src: elevation = src.read return elevation, src
def findhighestpoint: maxelevation = np.max maxelevationindex = np.where return maxelevation, maxelevationindex
def get_coordinates: lat, lon = src.xy return lat, lon
def visualize: fig, ax = plt.subplots) ax.imshow, cmap='terrain', extent=src.bounds) ax.scatter ax.settitle ax.setxlabel ax.set_ylabel plt.show
def main: filepath = 'pathtofile.tif' # 替换为GeoTIFF文件的实际路径 elevation, src = readgeotiff highestpointelevation, highestpointindex = findhighestpoint highestpointlat, highestpointlon = get_coordinates print print visualize
if name == 'main': main
确保将file_path变量替换为实际GeoTIFF文件路径。运行这段代码后它将计算并打印出Zui高大点的高大度和坐标,并在地图上可视化该点。
Demand feedback