https://github.com/vfdev-5/tinygeoimageutils
Some tools to quickly read geographical images and iterate over the image content by tiles
https://github.com/vfdev-5/tinygeoimageutils
gdal geographical-images tile
Last synced: 12 months ago
JSON representation
Some tools to quickly read geographical images and iterate over the image content by tiles
- Host: GitHub
- URL: https://github.com/vfdev-5/tinygeoimageutils
- Owner: vfdev-5
- License: mit
- Created: 2017-03-08T14:43:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-06T08:11:14.000Z (over 8 years ago)
- Last Synced: 2025-06-14T04:03:54.251Z (12 months ago)
- Topics: gdal, geographical-images, tile
- Language: Python
- Size: 6.22 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Tiny Geographical Image Utils
[](https://travis-ci.org/vfdev-5/TinyGeoImageUtils)
[](https://coveralls.io/github/vfdev-5/TinyGeoImageUtils)
Reading and manipulation of geographical images. Based on [GDAL](http://www.gdal.org/)
## Installation:
### Dependencies:
#### Linux
```
pip install numpy click
sudo apt-get install libgdal-dev
pip install gdal
```
#### MacOSX
```
pip install numpy
brew install gdal2
pip install gdal
```
### Repository
```
pip install git+https://github.com/vfdev-5/TinyGeoImageUtils.git
```
## Basic tools:
### Python API
* `GeoImage` for reading geographical images
* `GeoImageTiler` for tiled reading geographical images
#### Usage:
```python
import numpy as np
import matplotlib.pyplot as plt
from gimg import GeoImage
gimg = GeoImage("path/to/image/file")
data = gimg.get_data([0, 0, 500, 500])
print(data.shape, data.type)
plt.imshow(data[:, :, 0])
plt.show()
```
and
```python
import numpy as np
import matplotlib.pyplot as plt
from gimg import GeoImage
from gimg import GeoImageTilerConstSize
gimg = GeoImage("path/to/image/file")
tiles = GeoImageTilerConstSize(gimg, tile_size=(512, 512), min_overlapping=128)
for tile, x, y in tiles:
print(tile.shape, tile.type, x, y)
```
See other examples:
- [example.ipynb](examples/examples.ipynb)
- [create images](examples/create_images.py)
### CLI
#### `tile_generator`
Application to write tiles from input single image or a folder of images.
##### tiles of constant size
Generate tiles of constant size with overlapping.
```bash
> tile_generator const_size --help
Usage: tile_generator const_size [OPTIONS] INPUT_DIR_OR_FILE OUTPUT_DIR
TILE_SIZE_IN_PIXELS MIN_OVERLAPPING_IN_PIXELS
Options:
--extensions TEXT String of file extensions to select (if input is a
directory), e.g. 'jpg,png,tif'
--output_extension TEXT Output tile file extension
--n_workers INTEGER Number of workers in the processing pool
[default=4]
-q, --quiet Disable verbose mode
--help Show this message and exit.
```
For example,
```bash
> mkdir examples/tiles
> tile_generator const_size --extensions="jpg,png" examples/dog.jpg examples/tiles 256 20
```