Skip to content

ColonelAVP/SpatialAwareness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Spatial Awareness - Spatial Data Platform Backend Spatial Awareness is a geospatial data platform built using FastAPI and PostGIS, designed to handle point and polygon spatial data. It provides powerful REST APIs to perform spatial operations such as containment and proximity queries.

πŸš€ Features CRUD APIs for:

Multiple Points (e.g., farm plots, sensors, dealers)

Multiple Polygons (e.g., geofences, zones)

Spatial queries:

βœ… Get all points within a polygon

βœ… Get all polygons containing a point

βœ… Get all points within a radius (proximity search)

Swagger documentation for easy testing

Dockerized setup with persistent PostGIS database

🌍 Real-World Scenarios Demonstrated πŸ›‘οΈ HAL Zone Defense Check Polygon: HAL Zone (Defense area)

Points: 3 farm plots

Objective: Check whether any farm encroaches on the restricted zone using ST_Contains

πŸͺ Jayanagar 4th Block Market Optimization Polygon: Market zone

Points: 4 vegetable bulk dealers

Objective: Help vendors choose the nearest dealer using ST_DWithin and visualize dealer locations inside the market boundary

πŸ”§ Tech Stack Python 3.10

FastAPI

PostgreSQL + PostGIS

SQLAlchemy + GeoAlchemy2

Docker & Docker Compose

πŸ§ͺ API Endpoints πŸ“ Points POST /points/ β€” Create point

GET /points/ β€” List all points

GET /points/{id} β€” Get point by ID

PUT /points/{id} β€” Update point

DELETE /points/wipe β€” Delete all (dev-only)

GET /points/within-polygon/{polygon_id} β€” Points inside polygon

GET /points/nearby?lat=...&lng=...&radius=... β€” Points within radius

🟦 Polygons POST /polygons/ β€” Create polygon

GET /polygons/ β€” List all polygons

GET /polygons/{id} β€” Get polygon by ID

PUT /polygons/{id} β€” Update polygon

DELETE /polygons/wipe β€” Delete all (dev-only)

GET /polygons/contains-point/{point_id} β€” Polygons containing point

πŸ› οΈ Setup (Docker) Clone this repository

Run:

docker-compose up --build

Create tables (run inside container):

docker exec -it spatial_awareness_web_1 bash python

from app.db import Base, engine import app.models.point, app.models.polygon Base.metadata.create_all(bind=engine) exit()

Visit Swagger: http://localhost:8000/docs

πŸ“½οΈ Demo A product video demo has been recorded to walk through the features and real-world use cases clearly. You are encouraged to watch the demo to get full context.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors