gdal2xyz.py
Translates a raster file into xyz format.
简介
gdal2xyz [-help]
[-skip factor]
[-srcwin xoff yoff xsize ysize]
[-b band]* [-allbands]
[-skipnodata]
[-csv]
[-srcnodata value] [-dstnodata value]
src_dataset [dst_dataset]
描述
The gdal2xyz utility can be used to translate a raster file into xyz format. gdal2xyz can be used as an alternative to gdal_translate of=xyz, but supporting other options, for example:
Select more then one band
Skip or replace nodata value
Return the output as numpy arrays.
- -skip
How many rows/cols to skip in each iteration.
- -srcwin <xoff> <yoff> <xsize> <ysize>
根据像素/线位置从源图像中选择要复制的子窗口。
- -b, -band <band>
Select band band from the input spectral bands for output. Bands are numbered from 1 in the order spectral bands are specified. Multiple -b switches may be used. When no -b switch is used, the first band will be used. In order to use all input bands set -allbands or -b 0.
- -allbands
Select all input bands.
- -csv
Use comma instead of space as a delimiter.
- -skipnodata
Exclude the output lines with nodata value (as determined by srcnodata)
- -srcnodata
The nodata value of the dataset (for skipping or replacing) Default (None) - Use the dataset nodata value; Sequence/Number - Use the given nodata value (per band or per dataset).
- -dstnodata
Replace source nodata with a given nodata. Has an effect only if not setting -skipnodata. Default(None) - Use srcnodata, no replacement; Sequence/Number - Replace the srcnodata with the given nodata value (per band or per dataset).
- -h, --help
显示帮助消息并退出。
- <src_dataset>
源数据集名称。它可以是文件名、数据源的URL或多数据集文件的子数据集名称。
- <dst_dataset>
目标文件名。
实例
gdal2xyz -b 1 -b 2 -dstnodata 0 input.tif output.txt
To create a text file in xyz format from the input file input.tif, including the first and second bands, while replacing the dataset nodata values with zeros.