A lightweight, modern web GIS application for visualizing geospatial datasets in Kenya. Built with **Node.js + Express**, **Leaflet**, and **PostgreSQL/PostGIS**, the system streams GeoJSON directly from the database and supports dynamic BBOX queries for fast map rendering.
# Kenya GIS Webmap MVP
A lightweight, modern web GIS application for visualizing geospatial datasets in Kenya.
Built with **Node.js + Express**, **Leaflet**, and **PostgreSQL/PostGIS**, the system streams GeoJSON directly from the database and supports dynamic BBOX queries for fast map rendering.
---
## π Features
### **Frontend (Leaflet)**
- OpenStreetMap basemap
- Multiple thematic infrastructure layers:
- Healthcare facilities
- Schools
- Universities
- Power stations
- Polygon boundary layer (Counties)
- Automatic BBOX loading for point datasets
- Layer control panel
- Dynamic legend with per-layer colors
- Auto-fit map to loaded boundary features
### **Backend (Node.js + Express)**
- Clean REST API for all layers
- BBOX endpoints for fast spatial filtering
- PostGIS-powered spatial queries
- Optimized GeoJSON response pipeline
- Centralized database connection pool
### **Database (PostgreSQL + PostGIS)**
- Each infrastructure dataset stored as a table with a `geometry` column (EPSG:4326)
- Spatial indexing enabled for fast queries
---
## ποΈ Project Structure
webmap-mvp/
β
βββ public/
β βββ index.html
β βββ main.js
β βββ style.css
β βββ leaflet/ # Leaflet JS + CSS files
β
βββ server.js
βββ .env
βββ package.json
βββ README.md
yaml
Copy code
---
## π§ Requirements
Before running the project, ensure the following are installed:
| Component | Version |
|----------|---------|
| Node.js | β₯ 18.x |
| PostgreSQL | β₯ 14.x |
| PostGIS | Enabled extension |
| A browser | Any modern browser |
---
## π¦ Installation
Clone the repository:
git clone
github.com
cd kenya-gis-webmap-mvp
Install dependencies:
Copy code
npm install
Create a .env file:
Insert the below code and replace the password with the password of your postgresql server.
PGHOST=localhost
PGUSER=postgres
PGPASSWORD=yourpassword
PGDATABASE=gisdata
PGPORT=5432
PORT=3000
Place your dataset tables in PostgreSQL with:
id (optional)
geom geometry column β¦