This project is a FastAPI-based application for managing geo-data with PostgreSQL and PostGIS support. The API supports CRUD operations and is integrated with Swagger UI for API documentation.
- RESTful API for managing geo-data.
- Swagger UI available at
/docsfor testing endpoints. - Uses PostgreSQL with PostGIS for spatial data management.
- Python 3.10 or higher
- PostgreSQL with PostGIS enabled
- Clone the repositry
git clone https://github.com/PUNEET-EMM/Automated-Geospatial-Data-Ingestion-and-API-Service.git
cd <repository-folder>Install required Python packages:
pip install -r requirements.txt-
Configure the database:
Install PostgreSQL and enable the PostGIS extension:
- Install PostgreSQL on your machine (refer to PostgreSQL installation).
- Install PostGIS extension for PostgreSQL (refer to PostGIS installation).
-
Create a database with PostGIS:
CREATE DATABASE geo_database;
\c geo_database;
CREATE EXTENSION postgis;-
Update the
DATABASE_URLinapp/config.py:In the
config.pyfile within theappfolder, update theDATABASE_URLto match your PostgreSQL setup:
DATABASE_URL = "postgresql://<username>:<password>@localhost:5432/geo_database"- Run the application:
uvicorn app.main:app --reloadThis will start the FastAPI server locally.
-
Access the app:
Open your browser and visit the following URL to interact with the API documentation:
==========================
- Docker and Docker Compose installed.
-
Build and run the Docker containers:
docker-compose up --build
-
Access the application:
- Swagger UI: http://localhost:8000/docs
Here’s the updated and more descriptive API endpoints table to match the revised paths and naming conventions:
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/geo_data/view/{geo_data_id} |
Retrieve geo-data by ID. |
PUT |
/api/v1/geo_data/update/{geo_data_id} |
Update a geo-data entry by ID. |
DELETE |
/api/v1/geo_data/delete/{geo_data_id} |
Delete a geo-data entry by ID. |
PATCH |
/api/v1/geo_data/patch/{geo_data_id} |
Partially update a geo-data entry by ID. |
POST |
/api/v1/geo_data/create |
Create a new geo-data entry. |
GET |
/api/v1/geo_data/list |
Retrieve a list of all geo-data entries. |
{
"name": "string",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.99756,
40.73083
],
[
-73.996,
40.73177
],
[
-73.996,
40.73288
],
[
-73.99756,
40.73382
],
[
-73.99756,
40.73083
]
]
]
},
"properties": {
"key": "value"
}
}Swagger UI provides an interactive way to test these endpoints.