A Python GeoTiff kit based on GDAL
Project description
geotifflib
基于GDAL,对GeoTiff文件进行读写等操作。 GeoTiffLib primarily offers a set of utility functions for reading, saving, and processing GeoTIFF image files.
安装
由于使用pip安装GDAL报错,因此安装此包之前需要使用conda安装GDAL:
conda install GDAL
安装GDAL完成之后再安装本包:
pip install geotifflib
使用
主要包含了读、写两类函数。
read()
根据文件路径读取GeoTiff数据、地理变换和投影。
输入:
- 文件路径(Path or str)
返回:
- tiff的数据矩阵(np.array):shape = [波段,宽,长]
read_geo()
根据文件路径读取GeoTiff数据形状、地理变换和投影。
输入:
- 文件路径(Path or str)
返回:
- tiff的数据矩阵(np.array):shape = [波段,宽,长]
- geotransform: tuple
- projection: str
save()
保存GeoTiff数据、地理变换和投影。
输入:
- 保存路径(Path or str)
- tiff的数据矩阵(np.array):shape = [波段,宽,长]
- geotransform: tuple, tif file geotransform
- projection: str, tif file projection
- output dtype: gdal.GDT_Float32, tif file data type
save_array()
保存GeoTiff数据。
输入:
- 保存路径(Path or str)
- tiff的数据矩阵(np.array):shape = [波段,宽,长]
- output dtype: gdal.GDT_Float32, tif file data type
hsi_to_rgb()
将光谱数据转化到RGB(做了$\gamma$矫正和归一化)
输入:
- 光谱数据(np.ndarray):The hyperspectral image data, default shape is [bands, width, height].
- 红光波段索引(int):The index of the red band.
- 绿光波段索引(int):The index of the green band.
- 蓝光波段索引(int):The index of the blue band.
返回:
- The RGB image data, shape is [width, height, 3(r, g, b)].
merge()
合并多个GeoTiff
输入:
- 输入的tif图像路径列表(list[Path, Path...])
- 输出的tif图像路径(Path)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
geotifflib-0.0.4.tar.gz
(9.5 kB
view details)
File details
Details for the file geotifflib-0.0.4.tar.gz
.
File metadata
- Download URL: geotifflib-0.0.4.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eada91e080b4665bbc48e7f0c097e142b2d104b662228895b5a7545ebd632c3 |
|
MD5 | 64cbe650d406735dc26d8420c70249c1 |
|
BLAKE2b-256 | b364a2f2dd8fffb1bd7eb4a413c86fc1465570c1527f9bff9e8c6ed521c44dc5 |