2025-08-19
The website is centered around Urban Tree Inventory and Carbon Sequestration assessment. The main objective is be to provide the user with an easy interface where to load their data, calculate the carbon sequestration estimate for a given tree, and finally display the trees on a web map.
The calculation will be done with the below EPA formula:
\(CO_{2} = \frac{\pi*DBH^{2}*h*WD*CF}{4}\)
Where:
Urban Trees are key to residents well being. They are known for reducing harmful pollutants and mitigate summer air temperatures.
They also help offset the carbon footprint of a city.
Having a Urban Tree Inventory of private and public city trees is a great way to inform trends, get to know the carbon sequestered by the city, and also identifying areas lacking of trees.
tree_inventory database[1] tree_list:
tree_id: The unique identifier for the tree name (PRIMARY KEY)common_name: The common namespecies: The scientific nametype: Tye of wood (hardwood or conifer)growth: Growth rate (Fast, Moderate, or Slow)density: Wood density (float value)Source: EPA
[2] tree_records
record_id: The record unique identifier (PRIMARY KEY)tree_id: The tree species unique identifier (FOREIGN KEY)date: The record datedbh: The diameter at breast heightheight: The tree heightage: The tree agecarbon_storage: The carbon storage estimationlat: Latitudelon: Longitude[3] tree_map (table view)
This table view brings together the data recorded by the user, and displays more information about the tree by joining tree_list and tree_records:
common_name: The tree common name, from tree_listdate: The inventory record date, from tree_recorddbh: From tree_recordheight: From tree_recorddensity: From tree_listtype: From tree_listcarbon_storage: From tree_recordlat/lon: From tree_recordThe tables were created with SQL queries within PHP.
As an example, the map.php file:
<?php
require_once("db.php");
$ALL = array();
try {
$sql = "select * from tree_map order by date";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
// Push the entire associative array as an object
array_push($ALL, $row);
}
header('Content-Type: application/json');
echo json_encode($ALL);
} catch (Exception $e) {
echo $e->getMessage();
}
?>
Below the SQL query to create the tree_map table view:
CREATE VIEW `tree_map` AS
SELECT
`tree_list`.`common_name` AS `common_name`,
`tree_records`.`date` AS `date`,
`tree_records`.`dbh` AS `dbh`,
`tree_records`.`height` AS `height`,
`tree_list`.`density` AS `density`,
`tree_list`.`type` AS `type`,
`tree_records`.`carbon_storage` AS `carbon_storage`,
`tree_records`.`lat` AS `lat`,
`tree_records`.`lon` AS `lon`
FROM (`tree_records` join `tree_list`
on((`tree_list`.`tree_id` = `tree_records`.`tree_id`)))
The website is functional and can store user data, quantify the carbon captured, display the data on the map, and allows the user to download the data.
Additional improvements can be done: