Skip to main content

Zonal statistics and NDVI feature extraction for remote sensing ML pipelines

Project description

GeoFeatures

Python library for spectral index computation, zonal statistics, and vector/raster operations for remote sensing ML pipelines.

Install

pip install geofeatures

Spectral indices

Function Detects Inputs
compute_ndvi() Vegetation health NIR, Red
compute_evi() Dense vegetation NIR, Red, Blue
compute_savi() Sparse vegetation NIR, Red
compute_gndvi() Chlorophyll NIR, Green
compute_ndwi() Surface water Green, NIR
compute_mndwi() Urban water Green, SWIR
compute_ndmi() Vegetation moisture NIR, SWIR
compute_ndbi() Built-up areas SWIR, NIR
compute_bsi() Bare soil SWIR, Red, NIR, Blue
compute_nbr() Burn severity NIR, SWIR2

Zonal statistics

  • extract_zonal_features(raster_path, vector_gdf, stats)
  • ndvi_zonal_stats(...) — convenience wrapper (NDVI + zonal stats in one call)

Vector operations

  • merge_shapefiles(gdf_list, target_crs=None) — merge GeoDataFrames, handling CRS mismatches
  • dissolve_by_attribute(vector_gdf, attribute, agg_func="first") — dissolve polygons by shared attribute
  • clip_vector(vector_gdf, clip_boundary_gdf) — clip vector to a boundary

Raster-vector operations

  • clip_raster_by_vector(raster_path, vector_gdf, output_path) — clip a raster to a vector boundary

Validated

Tested end-to-end on real Sentinel-2 L2A imagery over Ogun State, Nigeria. 18 unit tests with hand-verified formula outputs and edge-case coverage (CRS mismatches, missing columns, spatial overlap logic).

License

MIT

Visualization

  • plot_raster(raster_path, title, cmap) — quick raster preview
  • plot_vector(vector_gdf, column, title) — quick vector/choropleth preview
  • plot_zonal_result(vector_gdf, column, title) — convenience wrapper for zonal stats results

Format conversion

  • convert_vector_format(input_path, output_path) — convert between Shapefile, GeoJSON, GPKG, KML
  • load_kmz(path) — load a KMZ (zipped KML) file
  • load_vector(path, target_crs, fix_invalid) — load with automatic geometry repair
  • load_raster_as_array(path) — load raster as numpy array + metadata

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

geofeatures-0.4.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

geofeatures-0.4.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file geofeatures-0.4.0.tar.gz.

File metadata

  • Download URL: geofeatures-0.4.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for geofeatures-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c8bc8d9a01bd63cfb3461c218b8e6ce8fb49aa4967a8441d0851ce43f95088c1
MD5 3ebd50aa7d23fa88576e7bc3641713c8
BLAKE2b-256 59bae92ab7f6815a8b6eff7b3570456e0c30825423a34686802a1761fe06c09b

See more details on using hashes here.

File details

Details for the file geofeatures-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: geofeatures-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for geofeatures-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdfd3b2b02da5ee92100caff535662a507dbbb176bba5d4da10baf84b4895796
MD5 1f1eeadef4374922c3932c11796e46e8
BLAKE2b-256 cfc8077a06ce484e3d856d8f36132446cd2534d78beab0321431dab21073203c

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