# 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
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/tnmthai/rasteric",
"name": "rasteric",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Thai Tran",
"author_email": "me@tnmthai.com",
"download_url": "https://files.pythonhosted.org/packages/36/fb/71fd439dbfd1288b91cddf2c4dbe73639954bbf5bee57ecef48530d87a1f/rasteric-1.0.1.tar.gz",
"platform": null,
"description": "# Rasteric: A Comprehensive Geospatial Library\r\n\r\n**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.\r\n\r\n## Supported Data Formats\r\n\r\nRasteric supports multiple geospatial data formats, including:\r\n\r\n- **Raster data**: GeoTIFF, TIFF\r\n- **Vector data**: Shapefiles, GeoJSON\r\n- **Tabular data**: CSV files with spatial attributes (e.g., latitude and longitude)\r\n\r\n---\r\n\r\n## Key Features and Functions\r\n\r\n### Data Handling\r\n- **`convpath()`**: Standardizes file paths for cross-platform compatibility.\r\n- **`stack()`**: Combines multiple raster files into a single multi-band raster.\r\n- **`mergecsv()`**: Combines multiple CSV files into a single CSV.\r\n\r\n### Data Analysis\r\n- **`zonalstats()`**: Computes zonal statistics for vector polygons based on raster values.\r\n- **`stats()`**: Provides basic raster statistics (min, max, mean, std).\r\n- **`ndvi()`**: Computes the Normalized Difference Vegetation Index.\r\n\r\n### Data Manipulation\r\n- **`clip()`**: Clips a raster using a vector file.\r\n- **`reproject()`**: Reprojects rasters to a specified coordinate reference system.\r\n- **`resample()`**: Changes raster resolution using a specified scaling factor.\r\n\r\n### Data Visualization\r\n- **`plot()`**: Displays a raster with customizable brightness and band selection.\r\n- **`contour()`**: Overlays contour lines on a raster image.\r\n- **`hist()`**: Plots a histogram of raster values.\r\n\r\n### Raster to Vector Conversion\r\n- **`convras()`**: Converts a raster file to vector polygons.\r\n\r\n### Extraction and Integration\r\n- **`extract()`**: Extracts raster values for vector features or CSV spatial points.\r\n- **`align_to_shp()`**: Aligns a raster's CRS to match a shapefile's CRS.\r\n\r\n---\r\n\r\n## Example Usage\r\n\r\n### Visualizing a Raster\r\n```python\r\nfrom rasteric import raster\r\nfrom matplotlib import pyplot\r\n\r\n# Plot raster bands with brightness adjustment\r\nraster.plot('example.tif', bands=(3, 2, 1), title=\"Example Raster\")\r\n```\r\n### Stacking Multiple Rasters\r\n```\r\nfrom rasteric import raster\r\n\r\n# Stack rasters into a single file\r\nstacked_file = raster.stack(\"data_folder\", \"stacked_output.tif\")\r\n```\r\n### Extracting Data\r\n```\r\nfrom rasteric import raster\r\n\r\n# Extract raster values for vector features\r\noutput_csv = raster.extract(\"example.tif\", \"vector.shp\")\r\n\r\n```\r\n### Computing NDVI\r\n```\r\nfrom rasteric import raster\r\n\r\n# Calculate NDVI and save the result\r\nndvi_output = raster.ndvi(\"example.tif\", \"ndvi_output.tif\", red_band=3, nir_band=4)\r\n\r\n```\r\n## Function Descriptions\r\n1. convpath(file_path)\r\nDescription: Converts a file path to a cross-platform compatible format.\r\n\r\n2. stack(input_folder, output_file)\r\nDescription: Stacks multiple rasters into a single file with multi-band output.\r\n\r\n3. mergecsv(path, outfile='combined.csv')\r\nDescription: Merges all CSV files in a directory into one.\r\n\r\n4. clip(raster_file, shapefile, output_file)\r\nDescription: Clips a raster using a shapefile's geometry.\r\n\r\n5. zonalstats(raster_file, vector_file, stats=['mean', 'max'])\r\nDescription: Calculates statistics for vector polygons over raster values.\r\n\r\n6. ndvi(raster_file, output_file, red_band, nir_band)\r\nDescription: Computes the Normalized Difference Vegetation Index.\r\n\r\n7. resample(input_raster, output_raster, scale_factor, resampling_method)\r\nDescription: Resamples a raster to a new resolution.\r\n\r\n8. extract(input_data, shp, output_csv, all_touched=False)\r\nDescription: Extracts raster values for vector features or CSV points.\r\n\r\n9. plot(file, bands, cmap, title, ax, brightness_factor)\r\nDescription: Plots raster data with band selection and brightness control.\r\n\r\n10. align_to_shp(input_tif, source_shp, output_tif)\r\nDescription: Reprojects a raster to align its CRS with a shapefile.\r\n\r\n### Contributions and Issues\r\nWe welcome contributions and issue reports! Please submit pull requests or report bugs via the GitHub repository.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Comprehensive Geospatial Library",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/tnmthai/rasteric/issues",
"Homepage": "https://github.com/tnmthai/rasteric",
"repository": "https://github.com/tnmthai/rasteric"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1f89183d6f952b972582e6eb528d40c828cc6b949b1310d87fffd47d82db0e29",
"md5": "9510e5f19f77833b091667683edd1879",
"sha256": "74ca94deb2a76c937715809a787e855c65959b3a666f27b9b1dbf4ef0202e406"
},
"downloads": -1,
"filename": "rasteric-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9510e5f19f77833b091667683edd1879",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17611,
"upload_time": "2024-11-28T00:07:06",
"upload_time_iso_8601": "2024-11-28T00:07:06.890545Z",
"url": "https://files.pythonhosted.org/packages/1f/89/183d6f952b972582e6eb528d40c828cc6b949b1310d87fffd47d82db0e29/rasteric-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "36fb71fd439dbfd1288b91cddf2c4dbe73639954bbf5bee57ecef48530d87a1f",
"md5": "04afa8a4d1d2126ffe0f06c9abadf341",
"sha256": "766ec4264b8e3701dcbd70730706ca90b66668b2efdba1ee4393464ab250707e"
},
"downloads": -1,
"filename": "rasteric-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "04afa8a4d1d2126ffe0f06c9abadf341",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 18883,
"upload_time": "2024-11-28T00:07:08",
"upload_time_iso_8601": "2024-11-28T00:07:08.508504Z",
"url": "https://files.pythonhosted.org/packages/36/fb/71fd439dbfd1288b91cddf2c4dbe73639954bbf5bee57ecef48530d87a1f/rasteric-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-28 00:07:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tnmthai",
"github_project": "rasteric",
"github_not_found": true,
"lcname": "rasteric"
}