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

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 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.2

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.2
File Size Uploaded Provenance
georag-0.1.2.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 11.6 kB

Release files / georag-0.1.2.tar.gz

Download URL georag-0.1.2.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2e2e914453897ca58380495bcf9680801bd544c2c87aefeca514d016b392fdd6
BLAKE2b-256 checksum
How to use checksums
d0dfc871f305e728c3a75b487c77a2ab6ea6d12aec042a21954ddaa529bf94e7
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.2-py3-none-any.whl

Download URL georag-0.1.2-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6736e74670a507720831ee00169d7eef450b0206b052073efd8b50c73629d11f
BLAKE2b-256 checksum
How to use checksums
8e994706fb46be121fa88bd5d25ac286af4737d2020ebbceb6d5a5af3cdbb502
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.2

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