VectorOps
A Python library for efficiently working with geospatial vector data using DuckDB. VectorOps simplifies querying, filtering, and manipulating GeoParquet files with support for both local and S3 storage.
Features
- Fast querying of GeoParquet files using DuckDB
- Support for both local and S3 data sources
- Spatial indexing using Hilbert curves for improved query performance
- Easy conversion between DuckDB tables and GeoDataFrames
- Partitioned writing of GeoParquet files
- SQL-based filtering and querying
Installation
pip install vectorops
Requirements
- geospatial-analysis-environment
Quick Start
Example data can be found in Notion: https://www.notion.so/GeoDataLake-1-0-1897554f2151804d9fdcefbe4ca50f26?pvs=4#19e7554f215180d19e99db64239c0976
Reading Data
from vectorops.geoduck import GeoDuck
# Local file
geoduck = GeoDuck("./data/counties.parquet")
# S3 file
geoduck = GeoDuck("s3://bucket/path/to/counties.parquet")
Querying Data
# SQL queries
result = geoduck.query("SELECT NAME FROM source WHERE state = 'CA'")
# Filter and create new view
geoduck.filter("population > 1000000", view="large_counties")
# Get as GeoDataFrame
gdf = geoduck.get_dataframe("large_counties")
Writing Data
# Write filtered data with partitioning
geoduck.write_parquet(
"./output/counties",
partition_by=["state"]
)
# Write GeoDataFrame directly
from vectorops.storage import save_gdf_to_parquet
save_gdf_to_parquet(gdf, "./output/counties", partition_by=["state"])
S3 Configuration
For S3 access, set the following environment variables:
export AWS_ACCESS_KEY_ID="your_access_key_id"
export AWS_SECRET_ACCESS_KEY="your_secret_access_key"
export AWS_ENDPOINT_URL="your_endpoint_url"
API Reference
GeoDuck Class
The main interface for working with geospatial data: Key methods:
__init__(path): Initialize with path to parquet file(s)filter(query, view): Filter data using SQL WHERE clausequery(sql): Execute custom SQL queryget_dataframe(view): Convert view to GeoDataFramewrite_parquet(path, view, partition_by): Write data to parquet
Storage Functions
Utility functions for data storage:
save_gdf_to_parquet(gdf, path, partition_by): Save GeoDataFrame to parquetwrite_view_to_parquet(con, view, path, partition_by): Write DuckDB view to parquet
Performance
VectorOps uses several optimizations for performance:
- Hilbert curve spatial indexing for improved query speed
- DuckDB for efficient SQL operations
- Lazy loading of data
- ZSTD compression for storage efficiency
Metadata
Release files for vectorops 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vectorops-0.1.1.tar.gz | 5.6 kB | Without provenance | Details for vectorops-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vectorops-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for vectorops-0.1.1-py3-none-any.whl |
Total release size: 12.3 kB
Release files / vectorops-0.1.1.tar.gz
| Download URL | vectorops-0.1.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a9fd1fe9b8ca7b6eb66a1c2fe6ab6e42200dc65af116197c7a5620a3f923583
|
|
BLAKE2b-256 checksum How to use checksums |
5625d79383fdcf50791b6a4a7de22eaaa835cf189b89ba544dfbda82c24fb923
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.1
|
Release files / vectorops-0.1.1-py3-none-any.whl
| Download URL | vectorops-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
040d78912749abc78567c26f191448df627b46d7bb45b1ed78010c339f8646fd
|
|
BLAKE2b-256 checksum How to use checksums |
0231164486b4697a0a590c524b17f8739364d1f7d974cb4e53ed4ef93c05b619
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.1
|
Security for vectorops 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.