geotifflib


Namegeotifflib JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/Flemyng1999/geotifflib
SummaryA Python GeoTiff kit based on GDAL
upload_time2024-05-16 07:20:06
maintainerNone
docs_urlNone
authorflemyng feng
requires_python>=3.9
licenseNone
keywords python tiff geotiff windows mac linux
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # geotifflib

基于GDAL,对GeoTiff文件进行读写等操作。
GeoTiffLib primarily offers a set of utility functions for reading, saving, and processing GeoTIFF image files.

## 安装

由于使用pip安装GDAL报错,因此安装此包之前需要**使用conda安装GDAL**:

```sh
conda install GDAL
```

安装GDAL完成之后再安装本包:

```sh
pip install geotifflib
```

## 使用

主要包含了读、写两类函数。

### read()

根据文件路径读取GeoTiff数据、地理变换和投影。

输入:

1. 文件路径(Path or str)

返回:

1. tiff的数据矩阵(np.array):shape = [波段,宽,长]

### read_geo()

根据文件路径读取GeoTiff数据形状、地理变换和投影。

输入:

1. 文件路径(Path or str)

返回:

1. tiff的数据矩阵(np.array):shape = [波段,宽,长]
2. geotransform: tuple
3. projection: str

### save()

保存GeoTiff数据、地理变换和投影。

输入:

1. 保存路径(Path or str)
2. tiff的数据矩阵(np.array):shape = [波段,宽,长]
3. geotransform: tuple, tif file geotransform
4. projection: str, tif file projection
5. output dtype: gdal.GDT_Float32, tif file data type

### save_array()

保存GeoTiff数据。

输入:

1. 保存路径(Path or str)
2. tiff的数据矩阵(np.array):shape = [波段,宽,长]
3. output dtype: gdal.GDT_Float32, tif file data type

### hsi_to_rgb()

将光谱数据转化到RGB(做了$\gamma$矫正和归一化)

输入:

1. 光谱数据(np.ndarray):The hyperspectral image data, default shape is **[bands, width, height]**.
2. 红光波段索引(int):The index of the red band.
3. 绿光波段索引(int):The index of the green band.
4. 蓝光波段索引(int):The index of the blue band.

返回:

1. The RGB image data, shape is **[width, height, 3(r, g, b)]**.

### merge()

合并多个GeoTiff

输入:

1. 输入的tif图像路径列表(list[Path, Path...])
2. 输出的tif图像路径(Path)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Flemyng1999/geotifflib",
    "name": "geotifflib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "python, tiff, geotiff, windows, mac, linux",
    "author": "flemyng feng",
    "author_email": "flemyng1999@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/b3/64/a2f2dd8fffb1bd7eb4a413c86fc1465570c1527f9bff9e8c6ed521c44dc5/geotifflib-0.0.4.tar.gz",
    "platform": null,
    "description": "# geotifflib\n\n\u57fa\u4e8eGDAL\uff0c\u5bf9GeoTiff\u6587\u4ef6\u8fdb\u884c\u8bfb\u5199\u7b49\u64cd\u4f5c\u3002\nGeoTiffLib primarily offers a set of utility functions for reading, saving, and processing GeoTIFF image files.\n\n## \u5b89\u88c5\n\n\u7531\u4e8e\u4f7f\u7528pip\u5b89\u88c5GDAL\u62a5\u9519\uff0c\u56e0\u6b64\u5b89\u88c5\u6b64\u5305\u4e4b\u524d\u9700\u8981**\u4f7f\u7528conda\u5b89\u88c5GDAL**\uff1a\n\n```sh\nconda install GDAL\n```\n\n\u5b89\u88c5GDAL\u5b8c\u6210\u4e4b\u540e\u518d\u5b89\u88c5\u672c\u5305\uff1a\n\n```sh\npip install geotifflib\n```\n\n## \u4f7f\u7528\n\n\u4e3b\u8981\u5305\u542b\u4e86\u8bfb\u3001\u5199\u4e24\u7c7b\u51fd\u6570\u3002\n\n### read()\n\n\u6839\u636e\u6587\u4ef6\u8def\u5f84\u8bfb\u53d6GeoTiff\u6570\u636e\u3001\u5730\u7406\u53d8\u6362\u548c\u6295\u5f71\u3002\n\n\u8f93\u5165\uff1a\n\n1. \u6587\u4ef6\u8def\u5f84\uff08Path or str\uff09\n\n\u8fd4\u56de\uff1a\n\n1. tiff\u7684\u6570\u636e\u77e9\u9635\uff08np.array\uff09\uff1ashape = [\u6ce2\u6bb5\uff0c\u5bbd\uff0c\u957f]\n\n### read_geo()\n\n\u6839\u636e\u6587\u4ef6\u8def\u5f84\u8bfb\u53d6GeoTiff\u6570\u636e\u5f62\u72b6\u3001\u5730\u7406\u53d8\u6362\u548c\u6295\u5f71\u3002\n\n\u8f93\u5165\uff1a\n\n1. \u6587\u4ef6\u8def\u5f84\uff08Path or str\uff09\n\n\u8fd4\u56de\uff1a\n\n1. tiff\u7684\u6570\u636e\u77e9\u9635\uff08np.array\uff09\uff1ashape = [\u6ce2\u6bb5\uff0c\u5bbd\uff0c\u957f]\n2. geotransform: tuple\n3. projection: str\n\n### save()\n\n\u4fdd\u5b58GeoTiff\u6570\u636e\u3001\u5730\u7406\u53d8\u6362\u548c\u6295\u5f71\u3002\n\n\u8f93\u5165\uff1a\n\n1. \u4fdd\u5b58\u8def\u5f84\uff08Path or str\uff09\n2. tiff\u7684\u6570\u636e\u77e9\u9635\uff08np.array\uff09\uff1ashape = [\u6ce2\u6bb5\uff0c\u5bbd\uff0c\u957f]\n3. geotransform: tuple, tif file geotransform\n4. projection: str, tif file projection\n5. output dtype: gdal.GDT_Float32, tif file data type\n\n### save_array()\n\n\u4fdd\u5b58GeoTiff\u6570\u636e\u3002\n\n\u8f93\u5165\uff1a\n\n1. \u4fdd\u5b58\u8def\u5f84\uff08Path or str\uff09\n2. tiff\u7684\u6570\u636e\u77e9\u9635\uff08np.array\uff09\uff1ashape = [\u6ce2\u6bb5\uff0c\u5bbd\uff0c\u957f]\n3. output dtype: gdal.GDT_Float32, tif file data type\n\n### hsi_to_rgb()\n\n\u5c06\u5149\u8c31\u6570\u636e\u8f6c\u5316\u5230RGB\uff08\u505a\u4e86$\\gamma$\u77eb\u6b63\u548c\u5f52\u4e00\u5316\uff09\n\n\u8f93\u5165\uff1a\n\n1. \u5149\u8c31\u6570\u636e\uff08np.ndarray\uff09:The hyperspectral image data, default shape is **[bands, width, height]**.\n2. \u7ea2\u5149\u6ce2\u6bb5\u7d22\u5f15\uff08int\uff09:The index of the red band.\n3. \u7eff\u5149\u6ce2\u6bb5\u7d22\u5f15\uff08int\uff09:The index of the green band.\n4. \u84dd\u5149\u6ce2\u6bb5\u7d22\u5f15\uff08int\uff09:The index of the blue band.\n\n\u8fd4\u56de\uff1a\n\n1. The RGB image data, shape is **[width, height, 3(r, g, b)]**.\n\n### merge()\n\n\u5408\u5e76\u591a\u4e2aGeoTiff\n\n\u8f93\u5165\uff1a\n\n1. \u8f93\u5165\u7684tif\u56fe\u50cf\u8def\u5f84\u5217\u8868\uff08list[Path, Path...]\uff09\n2. \u8f93\u51fa\u7684tif\u56fe\u50cf\u8def\u5f84\uff08Path\uff09\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python GeoTiff kit based on GDAL",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/Flemyng1999/geotifflib"
    },
    "split_keywords": [
        "python",
        " tiff",
        " geotiff",
        " windows",
        " mac",
        " linux"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b364a2f2dd8fffb1bd7eb4a413c86fc1465570c1527f9bff9e8c6ed521c44dc5",
                "md5": "64cbe650d406735dc26d8420c70249c1",
                "sha256": "6eada91e080b4665bbc48e7f0c097e142b2d104b662228895b5a7545ebd632c3"
            },
            "downloads": -1,
            "filename": "geotifflib-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "64cbe650d406735dc26d8420c70249c1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 9536,
            "upload_time": "2024-05-16T07:20:06",
            "upload_time_iso_8601": "2024-05-16T07:20:06.871001Z",
            "url": "https://files.pythonhosted.org/packages/b3/64/a2f2dd8fffb1bd7eb4a413c86fc1465570c1527f9bff9e8c6ed521c44dc5/geotifflib-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-16 07:20:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Flemyng1999",
    "github_project": "geotifflib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "geotifflib"
}
        
Elapsed time: 0.25168s