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.3.tar.gz (17.2 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.3-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysatgeo-0.4.3.tar.gz
  • Upload date:
  • Size: 17.2 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.3.tar.gz
Algorithm Hash digest
SHA256 d6a3199e87abb95cc72d4e13ebdac490a64beb134c8885f112d106d8a8a082b4
MD5 7e3a51e558d707e2cdeb3362c83f1024
BLAKE2b-256 f2f1ec5a6af76e2e8d4dde8e088fbd42ce78950effa936248d9daaa1d9073b16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysatgeo-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 17.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d6be9974cc99a2b04cafb8ba8c44b25e2ee6120249db27e3838c0e91f8ae9015
MD5 a788295f2cc3722c05c9d2323305c6b4
BLAKE2b-256 7dd4b9af340e637c2ff28c6924290d8a43928eb49175dfcc8117df109c59fa8b

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