Skip to main content

Python package for raster and vector geospatial processing

Project description

pysatgeo

PyPI version conda-forge version

pysatgeo is a small Python package for raster and vector geospatial processing.

The project started as a learning repo for packaging, CI, and geospatial utilities. It is now being cleaned up into a more maintainable library with basic tests and a smaller, clearer API surface.

Current Scope

The package currently focuses on a small set of raster and vector helpers:

  • raster reprojection, clipping, and resampling
  • raster alignment to a common grid
  • raster stacking with mean or sum
  • assigning CRS information to vector files
  • shifting a vector layer to match a raster reference extent
  • converting GeoJSON files to GeoParquet

Project Status

This package is still evolving.

  • Core packaging and import behavior have been cleaned up.
  • Basic automated tests are in place.
  • The API is still being narrowed and standardized.
  • Some geospatial workflows are more mature than others.

Installation

Because this package depends on geospatial libraries such as GDAL, rasterio, and geopandas, a Conda environment is usually the easiest setup, especially on Windows.

Example with Conda:

conda create -n pysatgeo python=3.11 -y
conda activate pysatgeo
conda install -c conda-forge geopandas rasterio rioxarray gdal pyarrow shapely xarray scikit-learn matplotlib mapclassify pytest -y
pip install -e .

If you already have a working Python environment with GDAL-compatible geospatial packages, you can also install the project with:

pip install -r requirements.txt
pip install -e .

Quick Start

Import modules directly:

from pysatgeo.raster import reproject_clip_resample_tiff, stack_rasters
from pysatgeo.vector import assign_crs_to_vector

Raster Example

Reproject, clip, and resample a raster:

from pysatgeo.raster import reproject_clip_resample_tiff

reproject_clip_resample_tiff(
    input_tiff="input.tif",
    output_tiff="output.tif",
    aoi_shapefile="aoi.geojson",
    target_srs="EPSG:32629",
    target_res_x=30,
    target_res_y=30,
    resampling_method="bilinear",
    clip=True,
    clip_by_extent=True,
    no_data=-9999,
)

Stack multiple rasters:

from pysatgeo.raster import stack_rasters

stack_rasters(
    tiff_files=["raster_1.tif", "raster_2.tif"],
    output_tiff="stacked_sum.tif",
    operation="sum",
)

Vector Example

Assign a CRS to a vector file:

from pysatgeo.vector import assign_crs_to_vector

assign_crs_to_vector(
    input_geojson_path="input.geojson",
    output_geojson_path="output.geojson",
    crs_epsg=4326,
)

Development

Run the test suite from the repository root:

pytest -v

The current tests cover:

  • package metadata import
  • raster and vector module import
  • basic validation errors
  • a simple vector CRS workflow

Documentation

Project documentation lives in the docs/ folder and is published at:

https://JPPereira93.github.io/pysatgeo

License

MIT License

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

pysatgeo-0.4.2.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

pysatgeo-0.4.2-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file pysatgeo-0.4.2.tar.gz.

File metadata

  • Download URL: pysatgeo-0.4.2.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for pysatgeo-0.4.2.tar.gz
Algorithm Hash digest
SHA256 a722bd0942593c1f3492c58edb6d5e2ab18d1a7ef89210f508020ff3c9438da4
MD5 a0a41caaf7e3c95639e5d7dda93f9173
BLAKE2b-256 bb71faf63144479eb2552531386fbbee23120f89cd15919fcadcf1b4a73f295a

See more details on using hashes here.

File details

Details for the file pysatgeo-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: pysatgeo-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for pysatgeo-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57d9a35a91d0d069bbff84fb077e6e4d5377de60a0085449332b65a27375ed56
MD5 14456a3462c10159afeaffe9f364640f
BLAKE2b-256 6dc8f76350b9c569234d51422d101a0e7ce893318720c9e8de7b458bdb691fa0

See more details on using hashes here.

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