The focal point of the provided code snippet revolves around the process of constructing a spatial graph from raster data. This spatial graph serves as a powerful tool for visualizing and analyzing spatial relationships and patterns present within the underlying geographic data.
In addition to forming the basic structure of vertices and edges, the code snippet emphasizes the integration of supplementary information. By utilizing custom structures, developers can enrich vertices and edges with additional details specific to their application domain. For instance, vertices can be decorated with labels or population data, while edges can incorporate distance metrics or other spatial attributes.
This approach enables the creation of spatial graphs that not only capture the topological relationships between locations but also incorporate contextual information essential for comprehensive spatial analysis and modeling.
Input
1#include "quetzal/geography.hpp"
7 std::string population_label =
"NA";
8 std::vector<double> population_data_chunk;
14 mp_units::quantity<mp_units::si::metre> distance;
18 MyEdgeInfo(
auto s,
auto t,
auto const& raster){
19 distance = raster.to_lonlat(s).great_circle_distance_to( raster.to_lonlat(t) );
25 auto file = std::filesystem::current_path() /
"data/bio1.tif";
28 std::vector<int> times(10);
29 std::iota(times.begin(), times.end(), 2001);
38 std::cout <<
"Graph has " << graph.num_vertices() <<
" vertices, " << graph.num_edges() <<
" edges." << std::endl;
40 for(
auto const& e : graph.edges() ){
41 std::cout << graph.source(e) <<
" <-> " << graph.target(e) <<
" : " << graph[e].distance << std::endl;
Individuals can not escape the landscape's borders.
Definition bound_policy.hpp:20
Discrete spatio-temporal variations of an environmental variable.
Definition raster.hpp:38
Geospatial data formatting and processing.
Definition geography.hpp:17
auto from_grid(SpatialGrid const &grid, VertexProperty const &v, EdgeProperty const &e, Vicinity const &vicinity, Directionality dir, Policy const &bounding_policy)
Spatial graph construction method.
Definition from_grid.hpp:36
boost::undirectedS isotropy
Property of a process independent of the direction of movement.
Definition directionality.hpp:18
Definition geography_graph_7.cpp:13
Definition geography_graph_7.cpp:6
Definition vicinity.hpp:53
Output
1Graph has 9 vertices, 36 edges.