gdalwarp [ -- help - general] [ -- formats]
[ - s_srs srs_def] [ - t_srs srs_def] [ - ct string] [ - to "NAME=VALUE"] * [ - novshiftgrid]
[ - order n | - tps | - rpc | - geoloc] [ - et err_threshold]
[ - refine_gcps tolerance [minimum_gcps]]
[ - te xmin ymin xmax ymax] [ - te_srs srs_def]
[ - tr xres yres] [ - tap] [ - ts width height]
[ - ovr level | AUTO | AUTO - n | NONE] [ - wo "NAME=VALUE"] [ - ot Byte / Int16 /... ]
[ - wt Byte / Int16]
[ - srcnodata "value [value...]"] [ - dstnodata "value [value...]"]
[ - srcalpha |- nosrcalpha] [ - dstalpha]
[ - r resampling_method] [ - wm memory_in_mb] [ - multi] [ - q]
[ - cutline datasource] [ - cl layer] [ - cwhere expression]
[ - csql statement] [ - cblend dist_in_pixels] [ - crop_to_cutline]
[ - of format] [ - co "NAME=VALUE"] * [ - overwrite]
[ - nomd] [ - cvmd meta_conflict_value] [ - setci] [ - oo NAME = VALUE] *
[ - doo NAME = VALUE] *
srcfile * dstfile
2).示例 :
案例:栅格数据合并/裁切/投影转换
场景: 想要将 data1 . img、data2 . img 格式文件 合并为 merge.img 格式文件 并设置无值区值为-9999
脚本:gdalwarp.exe -srcnodata -9999 -dstnodata -9999 -of HFA data1.img data2.img merge.img
参考:https://www.osgeo.cn/gdal/programs/gdalwarp.html
脚本:BAT脚本示范
@echo off
chcp 936
@echo "gdal/gdalwarp.exe" -srcnodata -9999 -dstnodata -9999 -of HFA data1.img data2.img merge.img
"gdal/gdalwarp.exe" -srcnodata -9999 -dstnodata -9999 -of HFA data1.img data2.img merge.img
pause
拓展1:BAT脚本,批量将.tif格式文件合并/裁切【按csv文件合并/裁切】
//MergeOrCut.bat
@echo off
chcp 936
setlocal enabledelayedexpansion
set tifvar=
for /f "delims=" %%a in (%1.csv) do (
set tifvar=!tifvar! %%a
)
@echo "gdal/gdalwarp.exe" --config GDAL_CACHEMAX 8192
--config GDAL_FILENAME_IS_UTF8 NO --config SHAPE_ENCODING UTF-8 --config GDAL_DATA gdal/gdal-data -crop_to_cutline -cutline %1.shp -co "BIGTIFF=YES" -multi
-wo NUM_THREADS=ALL_CPUS -wm 4096 -r cubic -overwrite %tifvar% %1.tif
"gdal/gdalwarp.exe" --config GDAL_CACHEMAX 8192
--config GDAL_FILENAME_IS_UTF8 NO --config SHAPE_ENCODING UTF-8 --config GDAL_DATA gdal/gdal-data -crop_to_cutline -cutline %1.shp -co "BIGTIFF=YES" -multi
-wo NUM_THREADS=ALL_CPUS -wm 4096 -r cubic -overwrite %tifvar% %1.tif
pause
//RunMergeOrCut.bat 【输出栅格与合并/裁剪矢量文件的名称】
@echo off
chcp 936
for /f "delims=" %%i in (name.txt) do (
call MergeOrCut.bat %%i
)
pause
拓展2:BAT脚本,批量将.tif格式文件合并/裁切【遍历目录合并/裁切】
//MergeOrCut.bat
@echo off
chcp 936
setlocal enabledelayedexpansion
set tifvar=
for /f "delims=" %%a in ('dir %3 /b/s') do (
set tifvar=!tifvar! %%a
)
@echo "gdal/gdalwarp.exe" --config GDAL_CACHEMAX 8192
--config GDAL_FILENAME_IS_UTF8 NO --config SHAPE_ENCODING UTF-8 --config GDAL_DATA gdal/gdal-data -crop_to_cutline -cutline %2 -co "BIGTIFF=YES" -multi
-wo NUM_THREADS=ALL_CPUS -wm 4096 -r cubic -overwrite %tifvar% %1.tif
"gdal/gdalwarp.exe" --config GDAL_CACHEMAX 8192
--config GDAL_FILENAME_IS_UTF8 NO --config SHAPE_ENCODING UTF-8 --config GDAL_DATA gdal/gdal-data -crop_to_cutline -cutline %2 -co "BIGTIFF=YES" -multi
-wo NUM_THREADS=ALL_CPUS -wm 4096 -r cubic -overwrite %tifvar% %1.tif
pause
//RunMergeOrCut.bat 【输出栅格文件名称】 【合并/裁剪矢量文件名称】【栅格目录】
@echo off
chcp 936
for /f "tokens=1-3 delims=," %%i in (name.txt) do (
call MergeOrCut.bat %%i %%j %%k
)
pause
拓展3:BAT脚本,将.tif格式文件投影转换
//Projection.bat
@echo off
chcp 936
@echo "gdal/gdalwarp.exe" --config GDAL_FILENAME_IS_UTF8 NO
--config SHAPE_ENCODING UTF-8 --config GDAL_DATA gdal/gdal-data -crop_to_cutline -multi -wo NUM_THREADS=ALL_CPUS -r cubic -overwrite -t_srs "EPSG:4326"
data.tif data_srs.tif
"gdal/gdalwarp.exe" --config GDAL_FILENAME_IS_UTF8 NO
--config SHAPE_ENCODING UTF-8 --config GDAL_DATA gdal/gdal-data -crop_to_cutline -multi -wo NUM_THREADS=ALL_CPUS -r cubic -overwrite -t_srs "EPSG:4326"
data.tif data_srs.tif
pause
对一幅或若干幅图像通过预处理、几何镶嵌、色调调整、去重叠等处理,镶嵌到一起生成一幅大的图像的影像处理方法 。
镶嵌之前应确保两幅影像经过了几何配准,具有相同的投影
1、产生一个空白文件(用于放置镶嵌结果,坐标系统和要镶嵌的图像完全一致,大小能容纳拟镶嵌图像之和 )
2、读入第一幅影像,将其设置参考图像,以其地理坐标及投影信息作为拼接后的影像地理坐标及投影信息
3、读入第二幅图像
4、对于重叠区处理 匀色处理、直方图匹配、镶嵌线设置,这里只进行了均值匀色
由于遥感正射影像通常具有黑色背景0值,重叠区匀色时应忽略0值
待镶嵌影像为两幅经过几何纠正的全色影像
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)