An intelligent assistant that converts natural language queries into executable GIS workflows using AI and open-source geospatial tools.
- Natural Language Processing: Convert plain English queries to GIS operations
- Multi-Model AI Integration: Mistral-7B, LLaMA-3-8B via LangChain
- Comprehensive GIS Tools: QGIS, GRASS GIS, GDAL/OGR, GeoPandas
- Real Data Sources: Bhoonidhi, OpenStreetMap, STAC APIs
- Interactive Interface: Streamlit + OpenLayers/Leaflet mapping
- Scalable Backend: FastAPI + PostgreSQL/PostGIS
User Query → Streamlit UI → FastAPI → AI Models → GIS Tools → Spatial Data → Results
- AI: Mistral-7B-Instruct, LLaMA-3-8B, LangChain, Transformers
- GIS: QGIS, GRASS GIS, GDAL/OGR, GeoPandas, PostGIS
- Backend: Python FastAPI, PostgreSQL
- Frontend: Streamlit, OpenLayers, Leaflet
- Data: Bhoonidhi, OpenStreetMap, STAC APIs
- Python 3.9+
- PostgreSQL with PostGIS
- QGIS with PyQGIS
- Docker (optional)
# Clone repository
git clone https://github.com/proavipatil/geospatial-ai-assistant.git
cd geospatial-ai-assistant
# Install dependencies
pip install -r requirements.txt
# Setup environment
cp .env.example .env
# Edit .env with your configurations
# Setup database
python scripts/setup_database.py
# Run the application
python scripts/run_app.py# Build and run with Docker
docker-compose up --build# Natural language queries the system can handle:
"Find all schools within 1km of hospitals in Mumbai"
"Calculate population density by district using census data"
"Identify flood-prone areas using elevation and rainfall data"
"Generate land use classification from satellite imagery"import requests
# Submit query
response = requests.post("http://localhost:8000/api/query",
json={"query": "Find schools near hospitals in Mumbai"})
# Get results
result = response.json()
print(result['workflow']) # AI-generated workflow
print(result['results']) # GIS analysis results- Start the application:
python scripts/run_app.py - Open browser:
http://localhost:8501 - Enter natural language query
- Review AI-generated workflow
- Execute analysis and view results
geospatial-ai-assistant/
├── src/
│ ├── ai/ # AI processing modules
│ │ ├── query_processor.py
│ │ ├── workflow_generator.py
│ │ └── model_manager.py
│ ├── gis/ # GIS processing engines
│ │ ├── qgis_engine.py
│ │ ├── gdal_processor.py
│ │ └── spatial_operations.py
│ ├── data/ # Data access and management
│ │ ├── osm_client.py
│ │ ├── stac_client.py
│ │ └── bhoonidhi_client.py
│ ├── api/ # FastAPI backend
│ │ ├── main.py
│ │ ├── routes/
│ │ └── models/
│ └── frontend/ # Streamlit application
│ ├── app.py
│ ├── components/
│ └── utils/
├── config/ # Configuration files
├── data/samples/ # Sample datasets
├── tests/ # Test suites
├── docker/ # Docker configuration
├── docs/ # Documentation
└── scripts/ # Utility scripts
# Run all tests
pytest tests/
# Run specific test suite
pytest tests/unit/
pytest tests/integration/
# Run with coverage
pytest --cov=src tests/- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the MIT License - see LICENSE file.
- OpenStreetMap contributors
- QGIS development team
- Hugging Face for AI models
- Indian Space Research Organisation (ISRO) for Bhoonidhi
