Urban Tree Inventory & Maintenance Management System
Urban trees play a crucial role in improving air quality, mitigating urban heat, and enhancing the quality of life in cities. Municipal governments and urban planners often need to maintain detailed inventories of trees to monitor their condition and plan maintenance activities.
Lisbon_GreenGrid is an urban tree inventory & maintenance management system. This project aims to develop a simple yet robust system for managing urban trees in Lisbon city. The system stores spatial information about trees, their species, size, location, other relevant info, and the authority responsible for maintenance status. It enables city planners or maintenance teams to efficiently query, insert, update, and manage tree-related data through a web application.
The main objectives of this project include:
- To centralize and manage urban tree inventory data in a structured spatial database.
- To support data-driven maintenance planning and risk assessment.
- To enable sustainable urban forestry decision-making.
- To provide an interactive map interface for visualization and analysis.
- To support full Create, Read, Update, and Delete (CRUD) operations
The system follows a clear and modular architecture:
Each component is independent and can be executed or tested separately. Input data in GeoJSON format is extracted, normalized, validated, and loaded into the target database.
The project employed open-access urban tree datasets, typically provided by:
- Lisbon open data portal (Portal Dados Abertos): https://dados.cm-lisboa.pt/dataset/arvoredo
The dataset include geographic coordinates, species information, and basic tree attributes. Lisbon Parishes shapefile obtained from CAOP 2024 was also used in this project. All datasets used are open source and free to use.
The database was implemented in PostgreSQL with the PostGIS extension and follows a relational model. More details about the database architecture and its execution procedure can be found in the Database README
| Table Name | Description | Spatial Data |
|---|---|---|
trees |
Individual urban trees and their locations | POINT |
operations |
Reference table for specific maintenance operations | No |
maintenance |
Maintenance records for the trees | No |
parish |
Administrative districts of Lisbon city | POLYGON |
users |
Details of users who make comments | No |
comments |
Reference table for comments made on different trees | No |
Key attributes:
tree_id(Primary Key) - Unique Tree ID from the Lisbon City Councilnome_vulga- Tree common nameespecie- Scientific nametipologia- Tree typepap- Perimeter at breast heightmanutencao- Authority in charge of a tree's maintenanceocupacao- Occupationlocal- Locationmorada- Addressfreguesia- Parish namegeometry(POINT geometry, SRID 4326)
The ETL pipeline follows a modular architecture:
- Configuration Layer
- Extraction Layer
- Transformation Layer
- Loading Layer
- Logging Layer
- Extracting raw data in GeoJSON format
- Cleaning and transforming the dataset
- Loading structured data into a POSTGIS database
- Logging pipeline execution
The ETL runs independently using a single command:
python main.py
Detailed information on the ETL structure, workflow and implementation can be found in the ETL README
The project supports full CRUD functionality:
- Create new tree records
- Read existing tree information
- Update tree attributes and maintenance records
- Delete obsolete or removed trees
CRUD operations is exposed through the API and executed against the relational database.
| Method | Endpoint | Description |
|---|---|---|
| GET | /trees |
Retrieve all trees |
| GET | /trees/{id} |
Retrieve a tree by ID |
| GET | /tree/{id}/comments |
Get comment history (with limit) |
| GET | /tree/{id}/maintenance |
Get maintenance history (with limit) |
| POST | /trees |
Insert a new tree |
| POST | /tree/{id}/comment |
Add a new comment |
| POST | /tree/{id}/maintenance |
Add a new maintenance status |
| PUT | /trees/{id} |
Update a tree |
| DELETE | /trees/{id} |
Delete a tree |
| GET | /trees/near?lat=&lon=&radius= |
Find nearby trees (spatial query) |
| GET | /trees/freguesia/{name} |
Get trees within a freguesia |
| GET | /trees/species/{species} |
Get trees by species |
The spatial query endpoint demonstrates the use of PostGIS for distance-based searches. Fined the details on API README
Follow these steps to clone this repository to your local machine.
-
Copy the Repository URL. Click the Code button on this repository page and copy the HTTPS or SSH URL.
-
Open Your Terminal. Navigate to the folder where you want the project to be stored.
-
Run the Clone Command.
git clone https://github.com/Lisbon-GreenGrid/Lisbon-GreenGrid
- Database Setup. Navigate to the
greengrid_dbfolder and execute the following in order:
00-create_db.sqlin pgAdmincreate_db.pyin the default python environment (creates schemas, tables, indexes, and triggers)06-data.sqlin pgAdmin after the execution of the ETL package.
-
Environment Setup. For both the ETL and API, install dependencies from either the
requirements.txtorenvironment.yml. Follow the information available in their respective README section. Do not forget to input your database password in theconfig/00.ymlfile. -
ETL Process. Navigate to the
greengrid_etlfolder and runmain.py. -
API Activation. Navigate to the
apifolder and runapi.py. -
Webpage Launch. Navigate to the
greengrid_webfolder and openindex.htmlusing a web browser.
In conclusion, Lisbon GreenGrid effectively extracts and transforms urban tree data, stores it within a structured PostGIS-enabled database, and delivers it through an interactive mapping interface for visualization and analysis. The project achieves its core objectives of centralizing tree inventory records, supporting maintenance tracking, and enabling data-driven urban decision-making.
- Dedicated page for sign-up and data security
- Defined boundaries between Admin and User roles
- Enhanced User Interface & Experience (UI/UX)
- Improved Pagination for easy assessibility
- Implementation of complex queries within API
Technology used include:
He earned a bachelor's degree in Geoinformatics & Surveying from the University of Ilorin, Ilorin, Nigeria and is currently pursuing a master's degree in Geospatial Technologies at NOVA IMS, Universidade NOVA de Lisboa, Portugal.
He earned a bachelor's degree in Geoinformatics & Surveying from the University of Nigeria, Nsukka (UNN), Nigeria and is currently pursuing a master's degree in Geospatial Technologies at NOVA IMS, Universidade NOVA de Lisboa, Portugal.
She earned a bachelor's degree in Geoinformatics Engineering from the National University of Science and Technology, H-12 Campus, Ismalabad, Pakistan and is currently pursuing a master's degree in Geospatial Technologies at NOVA IMS, Universidade NOVA de Lisboa, Portugal.
















