DigitalArzEngine for GEE, raster and vector data processing
Project description
DigitalArzEngine
DigitalArzEngine is a Python library designed to streamline raster data processing by extending the capabilities of the rasterio library. It provides a suite of tools for efficient geospatial transformations, mosaicing, and analysis, making it ideal for researchers, analysts, and developers working with geospatial raster data.
🚀 Features
- Mosaicing: Seamlessly merge multiple raster datasets into a unified output.
- Summary Statistics: Extract key metrics such as minimum, maximum, mean, and standard deviation from raster layers.
- Reprojection & Resampling: Transform raster datasets to different coordinate systems and resolutions with ease.
- Clipping & Masking: Apply geometric masks or clip rasters to specific regions of interest.
- Pixel-wise Analysis: Enable pixel-level operations for customized raster computations.
- Efficient I/O Handling: Support for reading, writing, and converting between various raster formats.
📦 Installation
To install the library using pip:
pip install digitalarzengine
📚 DataManager Utility Class
The DataManager class is a powerful and modular tool for handling geospatial data using SQLite databases. It supports structured storage of JSON records alongside geometric data (as WKB), with metadata tracking, querying, and integration with GeoPandas.
✅ Benefits and Usage
- Structured Storage: Stores geospatial records (geometry + attributes) in a portable
.dbformat. - Metadata Management: Tracks field names, geometry columns, and record counts.
- Geometry Support: Accepts and stores geometries as WKB with support for reprojection to EPSG:4326.
- Integration with GeoPandas: Easily convert the stored data into DataFrames and GeoDataFrames.
- Custom Query Support: Run filtered SQL queries and retrieve results as structured pandas objects.
- Extendable Schema: Dynamically add and update fields in your dataset.
🔧 Example Use-Cases
- Saving extracted geospatial features from remote sensing workflows.
- Iteratively storing geospatial model outputs with spatial context.
- Lightweight local spatial database for machine learning input.
🔄 Core Methods
add_record,update_record,delete_record,get_recordget_data_as_df,get_data_as_gdf,get_gdf_list_under_aoirecord_exists,change_key,add_column,update_column- Context manager support (
with DataManager(...) as dm:)
This utility class is designed to complement the raster processing tools in DigitalArzEngine, making it easier to work with both raster and vector data consistently.
🗃️ DBManager Utility Class
The DBManager class provides a secure and flexible way to interact with PostgreSQL/PostGIS databases. It builds SQLAlchemy engines from settings and supports reading data directly into Pandas or GeoPandas.
✅ Benefits and Usage
- Secure Configuration: Pulls database credentials from a centralized encrypted config using
CryptoUtils. - Flexible Access: Supports multiple environments or databases through the
from_configmethod. - SQLAlchemy Integration: Simplifies connection management and avoids hardcoding sensitive details.
- Read GeoData: Loads spatial tables directly into
GeoDataFrameusingread_postgis. - Exclude Geometry When Needed: Supports reading attribute-only tables as plain DataFrames.
🔧 Example Use-Cases
import os
from digitalarzengine.settings import DATA_DIR
from digitalarzengine.adapters.data_manager import DataManager
output_dir = os.path.join(DATA_DIR, 'pak', 'snow_cover/stats')
data_manager = DataManager(output_dir, base_name="snow_cover_normal_data",
purpose="snow cover normal data from 2001 to 2024")
data_manager.add_record("key_value", {})
- Connecting securely to remote geospatial databases for querying.
- Reading and processing large PostGIS tables as GeoDataFrames.
- Integrating web dashboards or data pipelines with PostgreSQL/PostGIS backends.
🔄 Core Methods
from_config(db_key): Load credentials and settings fromDATABASESget_engine(): Return SQLAlchemy engine objectread_as_geo_dataframe(): Read spatial data into GeoDataFrameread_as_dataframe(): Read tabular data with option to exclude geometryget_geometry_columns(): Identify spatial fields in the schema
⚙️ Configuration Example
Below is a sample DATABASES configuration dictionary to be placed in digitalarzengine/settings.py:
DATABASES = {
"drm": {
"ENGINE": "postgresql+psycopg2",
"NAME": "drm",
"USER": "dafast",
"PASSWORD": "***********************************",
"HOST": os.getenv("DB_HOST", "localhost"),
"PORT": "5432",
}
}
⚠️ Note: The password here is shown encrypted. It should be decrypted using
CryptoUtilsat runtime.
The DBManager is ideal for scenarios where spatial data needs to be read or processed securely from enterprise databases, complementing local DataManager workflows.
For more advanced usage patterns and custom queries, see the source or documentation site (coming soon).
👨💻 Developed by
Ather Ashraf Geospatial Data Scientist and AI Specialist
- 📧 Email: atherashraf@gmail.com
- 🌐 LinkedIn: https://sa.linkedin.com/in/ather-ashraf
- 📜 Google Scholar: View Profile
- 📱 WhatsApp: +966557252342 | +923224785104
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file digitalarzengine-0.4.21.tar.gz.
File metadata
- Download URL: digitalarzengine-0.4.21.tar.gz
- Upload date:
- Size: 129.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caaa798bcbdf101f04877c7c5f4a0e81da93dd01f6b2cfe56f46de35effdf16c
|
|
| MD5 |
f5da20d1212f13204140dc2b0de605ad
|
|
| BLAKE2b-256 |
8812b94745e1d9dd93902dea3f1bda58bc5062ac1a535e3f25aed665e45da198
|
File details
Details for the file digitalarzengine-0.4.21-py3-none-any.whl.
File metadata
- Download URL: digitalarzengine-0.4.21-py3-none-any.whl
- Upload date:
- Size: 142.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55e730e7657c9d196e40c6f5b405a5d8bb83b0351ca46e6cccc2d77d6e24c326
|
|
| MD5 |
fa9ba0d69c757caa44d27bde1400cefd
|
|
| BLAKE2b-256 |
201c8e138a78c03ffa58dd2664e14e7f11b2f6c77ea994b56395788521669d73
|