Skip to main content

GeoRAG

Spatial and Semantic RAG for real world engineering.

The Problem

If you have ever tried to build a RAG system that understands locations, you know standard vector databases fail completely. If you ask an AI to find "infrastructure damage within 50km of Lagos", a normal vector database just gives you articles about infrastructure damage from all over the world because it ignores the map.

I built GeoRAG to fix this. It is a python package that combines PostGIS mapping with pgvector semantic search in a single database, this means your AI only gets information that actually makes sense for the specific location you are asking about.

What it does

  • Hybrid Search: It filters out the wrong map locations first and then it finds the best matching text.
  • Smart Clustering: It uses Scikit-Learn to group your data points into real geographic regions so your AI does not get confused by scattered coordinates.
  • One Database: Everything lives in PostgreSQL, you do not need to sync a separate vector database with your main backend.

Quickstart

pip install georag

from georag import GeoRAGPipeline

# Set up the pipeline with your Django model
pipeline = GeoRAGPipeline(chunk_model=MySpatialChunk, max_clusters=3)

# Get context ready for your LLM
context = pipeline.generate_context(
    query_embedding=my_vector,
    target_longitude=3.3792,
    target_latitude=6.5244,
    radius_km=50.0
)

## Author & Next Steps
Feel free to open an issue or reach out at [makindeadedeji500@gmail.com](mailto:makindeadedeji500@gmail.com) if you have questions. 

**Upcoming Roadmap**
- [ ] **Interactive Demo:** Hosting a live instance on Hugging Face to visualize the spatial routing algorithm.
- [ ] **Architecture Breakdown:** Publishing a Hashnode article detailing the exact PostGIS and Scikit-Learn backend integration.

Metadata

Release files for georag 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for georag 0.1.1
File Size Uploaded Provenance
georag-0.1.1.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for georag 0.1.1
File Interpreter ABI Platform
georag-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / georag-0.1.1.tar.gz

Download URL georag-0.1.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
362c3bf8c2ed14a5d536a965451ba7bd71086c97a9389552c4a1e0a471ad0830
BLAKE2b-256 checksum
How to use checksums
64bc4b7c630c1dca85b3de4a3e35e947e993b6d13e165a396d8d8e0e4f31a959
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / georag-0.1.1-py3-none-any.whl

Download URL georag-0.1.1-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a2303ebfd462266ac7992a11d8c78f93f3d4914cbd1160a43db05f33cbc6226
BLAKE2b-256 checksum
How to use checksums
077a62f39c3e6d99fa513760af4a52fd7949d444a343534734062867187caa77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for georag 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page