GDAL 镶嵌至新图像(7)

本文介绍了一个Python脚本,使用GDAL库处理地理空间数据,通过地面控制点为马萨诸塞州的TIFF图像集创建一个统一的地理变换并生成mosaicTIFF文件,同时设置投影和地理变换矩阵。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# Script to use ground control points to add a geotransform to a raster.
# coding=utf-8
import glob
import math
import os
from osgeo import gdal, osr

# The get_extent function from the text is in ch10funcs.py.
import ch10funcs

# Don't forget to change the directory.
os.chdir(r'D:\DeskTop\learn_py_must\Learn_GDAL\osgeopy-data\osgeopy-data\Massachusetts')

# Get the list of tiffs that start with O.
in_files = glob.glob('O*.tif')       #会返回所有模糊查询:'O*.tif'的列表

# Loop through all of the files and get the bounding coordinates for the
# whole batch. This will be the output extent.
min_x, max_y, max_x, min_y = ch10funcs.get_extent(in_files[0])
for fn in in_files[1:]:
    minx, maxy, maxx, miny = ch10funcs.get_extent(fn)
    min_x = min(min_x, minx)
    max_y = max(max_y, maxy)
    max_x = max(max_x, maxx)
    min_y = min(min_y, miny)

# Calculate the dimensions for the output based on the ou
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值