給定經緯度和投影方式計算區域面積。多邊形適用。
from pyproj import Geod
from shapely.geometry import Point, LineString, Polygon
geod = Geod(ellps="WGS84")
print(geod.geometry_area_perimeter(Polygon([
(upper left), (bottom left),
(bottom right), (109.82248, 34.7432 (upper right))])))
讀取Landsat8 tiff文件格點信息
import gdal
filePath = 'merge_2019.tif'
dataset = gdal.Open(filePath)
geo_information = dataset.GetGeoTransform()
col = dataset.RasterXSize
row = dataset.RasterYSize
band = dataset.RasterCount
print(geo_information, col, row, band)