Data Acquisition
We will use the Overpass API and cpr to query OpenStreetMap for all the available tree data within the specified bounding box (bbox):
std::string query =
"[out:json]; (node(" + bbox + ")[\"natural\"=\"tree\"];); out;";
std::cout << "Query: " << query << std::endl;
cpr::Response r = cpr::Post(
cpr::Url{"http://overpass-api.de/api/interpreter"}, cpr::Body{query},
cpr::Header{{"Content-Type", "application/x-www-form-urlencoded"}},
cpr::Timeout{10000} // Set a timeout of 10 seconds
);
The http://overpass-api.de/api/interpreter
endpoint interprets and executes the Overpass QL queries, retrieving specific parts of the OpenStreetMap
data. In this case, the query fetches all nodes within the given bounding box tagged as natural=tree
.
If the query is not successful, a cpr.log
file will be generated to store the error message. Otherwise, the data will be stored in a .json
file.
A config.json
file is available for the user to specify the area of interest and other parameters:
{
"bbox": "48.5748, 7.7383,48.5918, 7.7610",
"LOD": 0,
"default_height_range": [3, 6],
"input_building_mesh": "mesh_lod1.msh",
"output_name": "stars_city",
"output_format": "msh",
"verbose": false,
"autorefine": true
}
Where :
-
bbox
: is the bounding box for the query in the format: (SW latitude, SW longitude, NE latitude, NE longitude) -
LOD
: is the level of details of the meshes (0, 1, 2 or 3) -
default_height_range
: is a range used to randomly assign a height to trees that do not have one. -
input_building_mesh
: is the name of the input file representing the terrain mesh. -
output_name
: is the name of the output file. -
output_format
: is the format of the output file (msh, stl, off). -
verbose
: is a boolean to enable or disable the verbose mode. -
autorefine
: is a boolean to enable or disable the automatic refinement of the tree meshes.
The data will be stored in query_result.json
file in the root directory of the project.
Here is an example of the query result for one tree:
{
"type": "node",
"id": 10162018740,
"lat": 48.5850910,
"lon": 7.7502624,
"tags": {
"circumference": "1.47655",
"diameter_crown": "5",
"genus": "Platanus",
"height": "6",
"leaf_cycle": "deciduous",
"leaf_type": "broadleaved",
"natural": "tree",
"ref": "16401",
"source": "data.strasbourg.eu - patrimoine_arbore",
"source:date": "2022-01-02",
"species": "Platanus acerifolia x",
"species:wikidata": "Q24853030"
}
}
Sometimes, multiple tags
can be missing, as shown here:
{
"type": "node",
"id": 4439566691,
"lat": 48.5839128,
"lon": 7.7487125,
"tags": {
"natural": "tree"
}
}
We will primarily use the tree’s GPS position
(latitude and longitude), its height
, its trunk’s circumference
, and its crown’s diameter
.
References
-
[verdie15] Yannick Verdie, Florent Lafarge, Pierre Alliez, "LOD Generation for Urban Scenes", ACM Transactions on Graphics, 34(3): 15, 2015, DOI: 10.1145/2766946
-
[verdie14] Yannick Verdie, Florent Lafarge, "Detecting parametric objects in large scenes by Monte Carlo sampling", International Journal of Computer Vision, 106(1): 57—75, 2014, DOI: 10.1007/s11263-013-0641-0
-
[stava14] O. Stava, S. Pirk, J. Kratt, B. Chen, R. Mech, O. Deussen, B. Benes, "Inverse Procedural Modeling of Trees", Preprint, 2014, Adobe Systems Inc., USA; University of Konstanz, Germany; Shenzhen Institute of Advanced Technology, China; Purdue University, USA.
-
[adtree] Shenglan Du, Roderik Lindenbergh, Hugo Ledoux, Jantien Stoter, Liangliang Nan, "AdTree: Accurate, Detailed, and Automatic Modelling of Laser-Scanned Trees", MDPI, 2019, MDPI: 2072-4292/11/8/942
-
[benes] Bedrich Benes, "Computational Vegetation", Computational Vegetation
-
[cgal] CGAL Development Team, "CGAL User and Reference Manual", CGAL User and Reference Manual
-
[feelpp] Feel Consortium, "Feel", Feel++ Documentation
-
[curl] "curl", curl Homepage
-
[meshlab] MeshLab Developers, "MeshLab", MeshLab Homepage
-
[overpass] OpenStreetMap Contributors, "Overpass API", Overpass API
-
[openstreetmap] "OpenStreetMap", OpenStreetMap Help
-
[img:TreeShade] Yujin Park, Jean-Michel Guldmann, Desheng Liu, "Impacts of tree and building shades on the urban heat island: Combining remote sensing, 3D digital city and spatial regression approaches", 2021, ScienceDirect: Impacts of tree and building shades on the urban heat island
-
[img:NY] Christophe Prud’homme, "New York City mesh", 2023, GitHub: New York City mesh
-
[img:aerialview] Conseil départemental de la Somme, "Aerial thermal view", 2023, Aerial thermal view
-
[img:street_thermography] P. Verchere, "Thermal image of a street in the city", 2023, The Conversation: Thermal image of a street in the city
-
[img:mercator] Bibm@th, "Mercator projection", 2024, Bibm@th: Mercator projection
-
[stl] Wikipedia, "STL (file format) - Wikipedia", 2023, Wikipedia: STL (file format)
-
[cgal_alpha_wrapper] Pierre Alliez, David Cohen-Steiner, Michael Hemmer, Cédric Portaneri, Mael Rouxel-Labbé, "CGAL 5.6.1 - 3D Alpha Wrapping", 2024, CGAL: 3D Alpha Wrapping
-
[cgal_affine_transformation] CGAL Development Team, "CGAL 5.6.1 - 2D and 3D Linear Geometry Kernel", 2024, CGAL: 2D and 3D Linear Geometry Kernel
-
[wgs84] Wikipedia, "World Geodetic System", 2024, Wikipedia: World Geodetic System
-
[wgs84_to_cartesian] Christian Berger, "WGS84toCartesian", 2021, GitHub: WGS84toCartesian
-
[k-nn] Wikipedia, "K-nearest neighbors algorithm", 2024, Wikipedia: K-nearest neighbors algorithm
-
[mercator-proj] Wikipedia, "Mercator projection", 2024, Wikipedia: Mercator projection
-
[sketchup] Wikipedia, "SketchUp", 2024, Wikipedia: SketchUp
-
[json] Wikipedia, "JSON", 2024, Wikipedia: JSON
-
[corefine-compute] CGAL Development Team, "CGAL 5.6.1 - 3D Alpha Shapes", 2024, CGAL: 3D Alpha Shapes
-
[hidalgo2-ubm] HiDALGO2, "Hidalgo2-UBM", 2024, HiDALGO2: Urban Building Model
-
[hidalgo2] HiDALGO2, "HiDALGO2", 2024, HiDALGO2 Homepage
-
[green-deal] European Commission, "European Green Deal", 2024, European Green Deal
-
[delaunay-wiki] Wikipedia, "Delaunay triangulation", 2024, Wikipedia: Delaunay triangulation
-
[hidalgo2-about] HiDALGO2, "About HiDALGO2", 2024, HiDALGO2: About
-
[cemosis] Cemosis, "Cemosis", 2024, Cemosis Homepage
-
[irma] IRMA, "IRMA", 2024, IRMA Homepage
-
[inria] INRIA, "INRIA", 2024, INRIA Homepage
-
[alliez] Pierre Alliez, "Pierre Alliez", 2024, Pierre Alliez Homepage
-
[chabannes] Vincent Chabannes, "Vincent Chabannes", 2024, ResearchGate: Vincent Chabannes
-
[paraview] Kitware, "ParaView", 2024, ParaView Homepage
-
[cgal-master] CGAL Development Team, "CGAL", 2024, CGAL GitHub
-
[overpass-ql] Roland Olbricht, "Overpass QL", 2024, Overpass QL
-
[overpass-turbo] Roland Olbricht, Martin Raifer, "Overpass turbo", 2024, Overpass turbo
-
[exaMA] ExaMA Consortium, "Exa-MA", 2024, Exa-MA: Methods and Algorithms for Exascale
-
[numpex] Numpex Consortium, "Numpex", 2024, Numpex Homepage
-
[gmsh] Christophe Geuzaine, Jean-François Remacle, "Gmsh", 2024, Gmsh Homepage
-
[img:tree-shape] Noriah Othman, Mashitah Mat Isa, Noralizawati Mohamed, Ramly Hasan, "Street Planting Compositions: The Public and Expert Perspectives", 2019, ResearchGate: Street Planting Compositions
-
[prudhomme] Christophe Prud’homme, "Christophe Prud’homme", 2024, ResearchGate: Christophe Prud’homme
-
[auto-refine-triangle-soup] CGAL Development Team, "CGAL 6.0 - Polygon Mesh Processing", 2024, CGAL: Polygon Mesh Processing
-
[cpr] CPR Developers, "Cpp Requests: Curl for People", 2024, GitHub: Cpp Requests
-
[pouvoir-arbre] Tania Landes , "The Conversation: D’où vient le pouvoir rafraîchissant des arbres en ville ?", 2023, The Conversation: D’où vient le pouvoir rafraîchissant des arbres en ville?
-
[science-direct] Yujin Park, Jean-Michel Guldmann, Desheng Liu, "Impacts of tree and building shades on the urban heat island: Combining remote sensing, 3D digital city and spatial regression approaches", 2021, ScienceDirect: Impacts of tree and building shades on the urban heat island
-
[gmsh-geo] Gmsh Developers, "Gmsh .geo file format", 2024, Gmsh .geo file format
-
[highest-plants] New Scientist - Aisling Irwin, "World’s highest plants discovered growing 6km above sea level", 2016, New Scientist: World’s highest plants discovered growing 6km above sea level
-
[raycasting] Wikipedia, "Ray casting", 2024, Wikipedia: Ray casting
-
[bvh] Wikipedia, "Bounding volume hierarchy", 2024, Wikipedia: Bounding volume hierarchy
-
[kd-tree] Wikipedia, "K-d tree", 2024, Wikipedia: K-d tree
-
[async] cplusplus.com, "std::async", 2024, cplusplus.com: std::async
-
[is_valid] CGAL Development Team, "CGAL 5.6.1 - 3D Mesh Generation", 2024, link:https://doc.cgal.org/latest/Surface_mesh/classCGAL_1_1Surface__mesh.html#a14cb5e4c51a02d652ba33bf906f39fc0[CGAL: is_valid()
-
[auto_refine_triangle_soup]] CGAL Development Team, "CGAL 6.0 - Polygon Mesh Processing", 2024, CGAL: autorefine_triangle_soup()
-
[deep_learning] Wikipedia, "Deep learning", 2024, Wikipedia: Deep learning
-
[numpex_exama] Numpex, "Exa-MA PC1", 2024, Numpex: Exa-MA PC1