Skip to main content

A Python package for geospatial iteration utilities

Project description

GeoIters

A simple package for geospatial iterators.

Installation

pip install geoiters (coming to pypi soon)

Usage

1. Grid Iterator

Grid by Rows and Columns

from geoiters.grid import GridIterator
from geoiters.utils import Extent

ext = Extent(-74.2, 40.65, -73.7, 40.85, crs="EPSG:4326")
itr = GridIterator(ext, rows=10, columns=10)

for i, patch in enumerate(itr):
    print(i, patch)

See the complete example here.

Grid by Max Patch Area

from geoiters.grid import GridIterator
from geoiters.utils import Extent

ext = Extent(-74.2, 40.65, -73.7, 40.85, crs="EPSG:4326")
itr = GridIterator(ext, patch_max_area=10_000_000) # area in sqm

for i, patch in enumerate(itr):
    print(i, patch)

See the complete example here.

To Use with Multiprocessing

import time
import multiprocessing as mp
from geoiters.utils import Extent
from geoiters.grid import GridIterator

def worker(patch: Extent):
    time.sleep(1) # simulate a time-consuming task
    print(f"Worker {mp.current_process().name}: "
          f"Processing patch with extent {patch}")

ext = Extent(-74.2, 40.65, -73.7, 40.85, crs="EPSG:4326")
itr = GridIterator(ext, rows=4, columns=4)

pool = mp.Pool(processes=4)
pool.map(worker, itr)
pool.close()
pool.join()

See the complete example here.

2. Tiles Iterator

from geoiters.grid import TilesIterator
from geoiters.utils import Extent

ext = Extent(-74.2, 40.65, -73.7, 40.85, crs="EPSG:4326")
itr = TilesIterator(ext, zoom_level=13)

for i, tile in enumerate(itr):
    print(i, tile)

See the complete example here.

Features

  • Lightweight and easy to use.
  • Efficient iteration over geospatial grids.
  • Divide a geographical extent into patches and iterate through them.
  • Divide a geographical extent by the number of rows and the number of columns.
  • Divide a geographical extent by the maximum area of a single patch.

To be Implemented

  • Implement a hexagonal tessellation iterator.
  • Overlapping patches.
  • Iteration order options (sequence, checkered, etc.)

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

geoiters-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoiters-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file geoiters-0.1.0.tar.gz.

File metadata

  • Download URL: geoiters-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geoiters-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1959c906c0b5073921740aabcc3752154af9076d9052d5f3ae08471652931425
MD5 497b74a0265b7628ef059103dd266f21
BLAKE2b-256 1887da1814c0e4722c261f1cdd7f6a2a7d2cac4216a9edfef8a6b46721885179

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoiters-0.1.0.tar.gz:

Publisher: publish_pypi.yml on sabughazal/geoiters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geoiters-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: geoiters-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geoiters-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e155054f29500f1a25201e20772bd1ec0576efc9aeb818f0e930bf26d63f734
MD5 7bc0ae082fb84990de55194df7e64d6a
BLAKE2b-256 946c99f0d9f04629208584a9a5dfabed5f453cc89ba1e48482b0d25d4c396b21

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoiters-0.1.0-py3-none-any.whl:

Publisher: publish_pypi.yml on sabughazal/geoiters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page