|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
|
Vector library - related fns for vector network analyses. More...

Go to the source code of this file.
Vector library - related fns for vector network analyses.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2009, 2014 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file net_analyze.c.
| dglGraph_s * Vect_net_get_graph | ( | struct Map_info * | Map | ) |
Get graph structure.
Graph is built by Vect_net_build_graph().
Returns NULL when graph is not built.
| Map | pointer to Map_info struct |
Definition at line 396 of file net_analyze.c.
Returns in cost for given direction in *cost.
cost is set to -1 if closed.
| Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
| line | line id | |
| direction | direction (GV_FORWARD, GV_BACKWARD) | |
| [out] | cost |
Definition at line 413 of file net_analyze.c.
References _, G_debug(), G_fatal_error(), GV_BACKWARD, and GV_FORWARD.
Referenced by Vect_net_nearest_nodes().
Get cost of node.
| Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
| node | node id | |
| [out] | cost | costs value |
Definition at line 467 of file net_analyze.c.
References G_debug().
| int Vect_net_nearest_nodes | ( | struct Map_info * | Map, |
| double | x, | ||
| double | y, | ||
| double | z, | ||
| int | direction, | ||
| double | maxdist, | ||
| int * | node1, | ||
| int * | node2, | ||
| int * | ln, | ||
| double * | costs1, | ||
| double * | costs2, | ||
| struct line_pnts * | Points1, | ||
| struct line_pnts * | Points2, | ||
| double * | distance | ||
| ) |
Find nearest node(s) on network.
| Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
| x,y,z | point coordinates (z coordinate NOT USED!) | |
| direction | (GV_FORWARD - from point to net, GV_BACKWARD - from net to point) | |
| maxdist | maximum distance to the network | |
| [out] | node1 | pointer where to store the node number (or NULL) |
| [out] | node2 | pointer where to store the node number (or NULL) |
| [out] | ln | pointer where to store the nearest line number (or NULL) |
| [out] | costs1 | pointer where to store costs on nearest line to node1 (not costs from x,y,z to the line) (or NULL) |
| [out] | costs2 | pointer where to store costs on nearest line to node2 (not costs from x,y,z to the line) (or NULL) |
| [out] | Points1 | pointer to structure where to store vertices on nearest line to node1 (or NULL) |
| [out] | Points2 | pointer to structure where to store vertices on nearest line to node2 (or NULL) |
| [out] | pointer | where to distance to the line (or NULL) |
| [out] | distance |
Definition at line 503 of file net_analyze.c.
References G_debug(), GV_BACKWARD, GV_FORWARD, line_pnts::n_points, NULL, PORT_DOUBLE_MAX, Vect_append_point(), Vect_find_line(), Vect_get_line_nodes(), Vect_line_distance(), Vect_line_length(), Vect_net_get_line_cost(), Vect_new_line_struct(), Vect_read_line(), Vect_reset_line(), line_pnts::x, line_pnts::y, and line_pnts::z.
| int Vect_net_shortest_path | ( | struct Map_info * | Map, |
| int | from, | ||
| int | to, | ||
| struct ilist * | List, | ||
| double * | cost | ||
| ) |
Find shortest path.
Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.
| Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
| from | from node | |
| to | to node | |
| [out] | List | list of line ids (path) |
| [out] | cost | costs value |
Definition at line 379 of file net_analyze.c.
| int Vect_net_shortest_path_coor | ( | struct Map_info * | Map, |
| double | fx, | ||
| double | fy, | ||
| double | fz, | ||
| double | tx, | ||
| double | ty, | ||
| double | tz, | ||
| double | fmax, | ||
| double | tmax, | ||
| double * | costs, | ||
| struct line_pnts * | Points, | ||
| struct ilist * | List, | ||
| struct ilist * | NodesList, | ||
| struct line_pnts * | FPoints, | ||
| struct line_pnts * | TPoints, | ||
| double * | fdist, | ||
| double * | tdist | ||
| ) |
Find shortest path on network between 2 points given by coordinates.
| Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) |
| fx,fy,fz | from point x coordinate (z ignored) |
| tx,ty,tz | to point x coordinate (z ignored) |
| fmax | maximum distance to the network from 'from' |
| tmax | maximum distance to the network from 'to' |
| costs | pointer where to store costs on the network (or NULL) |
| Points | pointer to the structure where to store vertices of shortest path (or NULL) |
| List | pointer to the structure where list of lines on the network is stored (or NULL) |
| NodesList | pointer to the structure where list of nodes on the network is stored (or NULL) |
| FPoints | pointer to the structure where to store line from 'from' to first network node (or NULL) |
| TPoints | pointer to the structure where to store line from last network node to 'to' (or NULL) |
| fdist | distance from 'from' to the net (or NULL) |
| tdist | distance from 'to' to the net (or NULL) |
Definition at line 1020 of file net_analyze.c.
| int Vect_net_ttb_shortest_path | ( | struct Map_info * | Map, |
| int | from, | ||
| int | from_type, | ||
| int | to, | ||
| int | to_type, | ||
| int | tucfield, | ||
| struct ilist * | List, | ||
| double * | cost | ||
| ) |
Find shortest path on network.
Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.
| Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
| from | start of the path | |
| from_type | if 0 - node id (intersection), if 1 - line unique cat | |
| to | end of the path | |
| to_type | if 0 - node id (intersection), if 1 - line unique cat | |
| tucfield | field with unique categories used in the turntable | |
| [out] | List | list of line ids (path) |
| [out] | cost | costs value |
Definition at line 259 of file net_analyze.c.
References _, bound_box::B, bound_box::E, G_debug(), G_fatal_error(), G_warning(), GV_POINT, bound_box::N, NULL, bound_box::S, bound_box::T, t, Vect_cat_get(), Vect_destroy_boxlist(), Vect_destroy_cats_struct(), Vect_get_node_coor(), Vect_new_boxlist(), Vect_new_cats_struct(), Vect_read_line(), Vect_select_lines_by_box(), bound_box::W, and x.
| int Vect_net_ttb_shortest_path_coor | ( | struct Map_info * | Map, |
| double | fx, | ||
| double | fy, | ||
| double | fz, | ||
| double | tx, | ||
| double | ty, | ||
| double | tz, | ||
| double | fmax, | ||
| double | tmax, | ||
| int | tucfield, | ||
| double * | costs, | ||
| struct line_pnts * | Points, | ||
| struct ilist * | List, | ||
| struct ilist * | NodesList, | ||
| struct line_pnts * | FPoints, | ||
| struct line_pnts * | TPoints, | ||
| double * | fdist, | ||
| double * | tdist | ||
| ) |
Find shortest path on network with turntable between 2 points given by coordinates.
| Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) |
| fx,fy,fz | from point x coordinate (z ignored) |
| tx,ty,tz | to point x coordinate (z ignored) |
| fmax | maximum distance to the network from 'from' |
| tmax | maximum distance to the network from 'to' |
| tucfield | field with unique categories used in the turntable |
| costs | pointer where to store costs on the network (or NULL) |
| Points | pointer to the structure where to store vertices of shortest path (or NULL) |
| List | pointer to the structure where list of lines on the network is stored (or NULL) |
| NodesList | pointer to the structure where list of nodes on the network is stored (or NULL) |
| FPoints | pointer to the structure where to store line from 'from' to first network node (or NULL) |
| TPoints | pointer to the structure where to store line from last network node to 'to' (or NULL) |
| fdist | distance from 'from' to the net (or NULL) |
| tdist | distance from 'to' to the net (or NULL) |
Definition at line 1056 of file net_analyze.c.