Skip to main content

A Comprehensive Geospatial Library

Project description

Rasteric: A Comprehensive Geospatial Library

Rasteric is a comprehensive library for geospatial data preprocessing, analysis, and modeling. It provides a variety of functions for transforming, analyzing, and manipulating geospatial data, including raster and vector data.

Supported Data Formats

Rasteric supports multiple geospatial data formats, including:

  • Raster data: GeoTIFF, TIFF
  • Vector data: Shapefiles, GeoJSON
  • Tabular data: CSV files with spatial attributes (e.g., latitude and longitude)

Key Features and Functions

Data Handling

  • convpath(): Standardizes file paths for cross-platform compatibility.
  • stack(): Combines multiple raster files into a single multi-band raster.
  • mergecsv(): Combines multiple CSV files into a single CSV.

Data Analysis

  • zonalstats(): Computes zonal statistics for vector polygons based on raster values.
  • stats(): Provides basic raster statistics (min, max, mean, std).
  • ndvi(): Computes the Normalized Difference Vegetation Index.

Data Manipulation

  • clip(): Clips a raster using a vector file.
  • reproject(): Reprojects rasters to a specified coordinate reference system.
  • resample(): Changes raster resolution using a specified scaling factor.

Data Visualization

  • plot(): Displays a raster with customizable brightness and band selection.
  • contour(): Overlays contour lines on a raster image.
  • hist(): Plots a histogram of raster values.

Raster to Vector Conversion

  • convras(): Converts a raster file to vector polygons.

Extraction and Integration

  • extract(): Extracts raster values for vector features or CSV spatial points.
  • align_to_shp(): Aligns a raster's CRS to match a shapefile's CRS.

Example Usage

Visualizing a Raster

from rasteric import raster
from matplotlib import pyplot

# Plot raster bands with brightness adjustment
raster.plot('example.tif', bands=(3, 2, 1), title="Example Raster")

Stacking Multiple Rasters

from rasteric import raster

# Stack rasters into a single file
stacked_file = raster.stack("data_folder", "stacked_output.tif")

Extracting Data

from rasteric import raster

# Extract raster values for vector features
output_csv = raster.extract("example.tif", "vector.shp")

Computing NDVI

from rasteric import raster

# Calculate NDVI and save the result
ndvi_output = raster.ndvi("example.tif", "ndvi_output.tif", red_band=3, nir_band=4)

Function Descriptions

  1. convpath(file_path) Description: Converts a file path to a cross-platform compatible format.

  2. stack(input_folder, output_file) Description: Stacks multiple rasters into a single file with multi-band output.

  3. mergecsv(path, outfile='combined.csv') Description: Merges all CSV files in a directory into one.

  4. clip(raster_file, shapefile, output_file) Description: Clips a raster using a shapefile's geometry.

  5. zonalstats(raster_file, vector_file, stats=['mean', 'max']) Description: Calculates statistics for vector polygons over raster values.

  6. ndvi(raster_file, output_file, red_band, nir_band) Description: Computes the Normalized Difference Vegetation Index.

  7. resample(input_raster, output_raster, scale_factor, resampling_method) Description: Resamples a raster to a new resolution.

  8. extract(input_data, shp, output_csv, all_touched=False) Description: Extracts raster values for vector features or CSV points.

  9. plot(file, bands, cmap, title, ax, brightness_factor) Description: Plots raster data with band selection and brightness control.

  10. align_to_shp(input_tif, source_shp, output_tif) Description: Reprojects a raster to align its CRS with a shapefile.

Contributions and Issues

We welcome contributions and issue reports! Please submit pull requests or report bugs via the GitHub repository.

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

rasteric-1.1.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

rasteric-1.1.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file rasteric-1.1.0.tar.gz.

File metadata

  • Download URL: rasteric-1.1.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for rasteric-1.1.0.tar.gz
Algorithm Hash digest
SHA256 53bad5dc3b65a16ddb5ecb6dd86b2a8df0c38e46591bf0362631f201ea3b8567
MD5 8cb9df44b04d614f574f9d1ee0f51146
BLAKE2b-256 6c9c31520da2e29b6c4ed81ce46d6ae850a5c3cd6394e0b63c7847177c7441a0

See more details on using hashes here.

File details

Details for the file rasteric-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: rasteric-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for rasteric-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d2eebbd37ccaa7f78fa34459da00535e42e7f91c604c3f5901457af96108c71
MD5 c7992c90ff7a42ebe55e5a167d4529e3
BLAKE2b-256 4fa65e13b7f84d1f2769822cd2e0f9fbb27b4b62aad4386d5937a2a567a4e10b

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