A fully functional Spring Boot REST API for geospatial analysis, growth tracking, and hotspot detection.
- Quick Start Guide - Get started in 5 minutes
- Setup Instructions - Detailed installation guide
- API Documentation - Complete API reference
- Architecture - System design and flow
- Project Summary - Overview and features
- Regions Management: CRUD operations for geographic regions
- Signals Tracking: Store and manage growth indicators
- Hotspot Detection: Identify high-potential areas by score
- Input validation
- Error handling with proper HTTP codes
- Consistent JSON responses
- Database relationships
- Sample data initialization
- Comprehensive documentation
- Automated test script (
test-api.sh) - Postman collection
- Sample API calls
- H2 console access
- Urban Planning: Track city development indicators
- Investment Analysis: Identify growth regions
- Real Estate: Location scoring for development
- Business Intelligence: Optimal expansion locations
- Java 17
- Spring Boot 3.2.3
- Spring Web (REST API)
- Spring Data JPA (Database)
- H2 Database (SQL)
- Lombok (Code simplification)
- Maven (Build tool)
| Endpoint | Purpose |
|---|---|
/api/regions |
Manage geographic regions |
/api/signals |
Track growth indicators |
/api/hotspots |
Get top-scoring regions |
- Install Java Extension Pack
- Open project folder
- Run
GeospatialAnalysisApplication.java
cd SpringBootRestAPI
mvn spring-boot:runServer runs at: http://localhost:8080
# Test if running
curl http://localhost:8080/api/regions
# Create a region
curl -X POST http://localhost:8080/api/regions \
-H "Content-Type: application/json" \
-d '{
"name": "Tech Hub",
"latitude": 37.7749,
"longitude": -122.4194,
"description": "Innovation center"
}'
# Get hotspots
curl http://localhost:8080/api/hotspots?limit=5SpringBootRestAPI/
├── src/main/java/com/geospatial/
│ ├── controller/ # REST endpoints
│ ├── service/ # Business logic
│ ├── repository/ # Database access
│ ├── entity/ # Data models
│ ├── dto/ # API objects
│ ├── exception/ # Error handling
│ └── config/ # Configuration
├── src/main/resources/
│ └── application.properties
├── pom.xml
├── README.md # Full API docs
├── QUICKSTART.md # Quick start
├── SETUP.md # Installation
├── ARCHITECTURE.md # System design
├── PROJECT_SUMMARY.md # Overview
├── test-api.sh # Test script
└── Geospatial-API.postman_collection.json
- Start with QUICKSTART.md
- Learn the API from README.md
- Understand design via ARCHITECTURE.md
- See SETUP.md for Java/Maven installation
- Check PROJECT_SUMMARY.md for complete overview
- Run
./test-api.shfor automated tests - Import
Geospatial-API.postman_collection.jsoninto Postman
The app starts with 3 regions and 7 signals:
- Silicon Valley (tech hub)
- Downtown District (business center)
- East Bay (emerging area)
View data directly: http://localhost:8080/h2-console
- URL:
jdbc:h2:mem:geospatialdb - User:
sa - Password: (empty)
# 1. Start the application
mvn spring-boot:run
# 2. View existing regions
curl http://localhost:8080/api/regions
# 3. Create a new region
curl -X POST http://localhost:8080/api/regions \
-H "Content-Type: application/json" \
-d '{"name": "New Area", "latitude": 37.5, "longitude": -122.5, "description": "Growing region"}'
# 4. Add growth indicators
curl -X POST http://localhost:8080/api/signals \
-H "Content-Type: application/json" \
-d '{"regionId": 1, "indicatorType": "POPULATION_GROWTH", "score": 85.0, "description": "High growth"}'
# 5. Find hotspots
curl http://localhost:8080/api/hotspots?limit=5Regions automatically calculate total scores from all their signals.
POSTcreates resources (201 Created)GETretrieves data (200 OK)PUTupdates resources (200 OK)DELETEremoves resources (200 OK)404for not found409for conflicts400for validation errors
{
"success": false,
"message": "Region not found with ID: 999",
"data": null
}All requests validated automatically:
- Required fields checked
- Data types enforced
- Clear error messages
Edit DataInitializer.java to add custom types:
- TECH_INVESTMENT
- POPULATION_GROWTH
- POI_COUNT
- BUSINESS_ACTIVITY
- INFRASTRUCTURE_SCORE
- EMPLOYMENT_RATE
- (Add your own!)
Replace H2 with PostgreSQL/MySQL in pom.xml and application.properties
The layered architecture makes it easy to extend:
- Add new endpoints in controllers
- Add business logic in services
- Add queries in repositories
- Can't install Java/Maven? → See SETUP.md
- How do I run it? → See QUICKSTART.md
- What endpoints exist? → See README.md
- How does it work? → See ARCHITECTURE.md
PROJECT COMPLETE - Ready to run!
- ✅ All endpoints implemented
- ✅ Database configured
- ✅ Sample data loaded
- ✅ Error handling complete
- ✅ Documentation finished
- ✅ Tests provided
- ✅ Production-ready structure
This project is open source and available under the MIT License.
Ready to start? Open QUICKSTART.md and begin in minutes!