|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
|
Vector library - area-related functions. More...
#include <stdlib.h>#include <grass/vector.h>#include <grass/glocale.h>#include "pg_local_proto.h"#include "local_proto.h"
Go to the source code of this file.
Functions | |
| int | Vect_get_area_points (struct Map_info *Map, int area, struct line_pnts *BPoints) |
| Returns polygon array of points (outer ring) of given area. | |
| int | Vect_get_isle_points (struct Map_info *Map, int isle, struct line_pnts *BPoints) |
| Returns polygon array of points for given isle. | |
| int | Vect_get_area_centroid (struct Map_info *Map, int area) |
| Returns centroid id for given area. | |
| int | Vect_get_area_boundaries (struct Map_info *Map, int area, struct ilist *List) |
| Creates list of boundaries for given area. | |
| int | Vect_get_isle_boundaries (struct Map_info *Map, int isle, struct ilist *List) |
| Creates list of boundaries for given isle. | |
| int | Vect_get_area_num_isles (struct Map_info *Map, int area) |
| Returns number of isles for given area. | |
| int | Vect_get_area_isle (struct Map_info *Map, int area, int isle) |
| Returns isle id for area. | |
| int | Vect_get_isle_area (struct Map_info *Map, int isle) |
| Returns area id for isle. | |
| double | Vect_get_area_perimeter (struct Map_info *Map, int area) |
| Returns perimeter of area with perimeter of isles. | |
| int | Vect_point_in_area (double x, double y, struct Map_info *Map, int area, struct bound_box *box) |
| Check if point is in area. | |
| double | Vect_get_area_area (struct Map_info *Map, int area) |
| Returns area of area without areas of isles. | |
| int | Vect_get_area_cats (struct Map_info *Map, int area, struct line_cats *Cats) |
| Get area categories. | |
| int | Vect_get_area_cat (struct Map_info *Map, int area, int field) |
| Find FIRST category of given field and area. | |
| int | Vect__get_area_points (struct Map_info *Map, const plus_t *lines, int n_lines, struct line_pnts *BPoints) |
| Get area boundary points (internal use only) | |
| int | Vect__get_area_points_nat (struct Map_info *Map, const plus_t *lines, int n_lines, struct line_pnts *BPoints) |
| Get area boundary points (native format) | |
Vector library - area-related functions.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2009, 2011-2013 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 vector/Vlib/area.c.
| int Vect__get_area_points | ( | struct Map_info * | Map, |
| const plus_t * | lines, | ||
| int | n_lines, | ||
| struct line_pnts * | BPoints | ||
| ) |
Get area boundary points (internal use only)
For PostGIS Topology calls Vect__get_area_points_pg() otherwise Vect__get_area_points_nat(),
| Map | pointer to Map_info struct | |
| lines | array of boundary lines | |
| n_lines | number of lines in array | |
| [out] | BPoints | pointer to output line_pnts struct |
Definition at line 486 of file vector/Vlib/area.c.
References _, G_fatal_error(), GV_FORMAT_POSTGIS, Vect__get_area_points_nat(), and Vect__get_area_points_pg().
Referenced by Vect_build_line_area(), and Vect_get_area_points().
| int Vect__get_area_points_nat | ( | struct Map_info * | Map, |
| const plus_t * | lines, | ||
| int | n_lines, | ||
| struct line_pnts * | BPoints | ||
| ) |
Get area boundary points (native format)
Used by Vect_build_line_area() and Vect_get_area_points().
| Map | pointer to Map_info struct | |
| lines | array of boundary lines | |
| n_lines | number of lines in array | |
| [out] | BPoints | pointer to output line_pnts struct |
Definition at line 515 of file vector/Vlib/area.c.
References G_debug(), GV_BACKWARD, GV_FORWARD, NULL, Vect_append_points(), Vect_new_line_struct(), Vect_read_line(), and Vect_reset_line().
Referenced by Vect__get_area_points(), and Vect_get_isle_points().
Returns area of area without areas of isles.
| Map | pointer to Map_info structure |
| area | area id |
Definition at line 374 of file vector/Vlib/area.c.
References G_area_of_polygon(), G_begin_polygon_area_calculations(), G_debug(), P_area::isles, P_area::n_isles, line_pnts::n_points, Vect_destroy_line_struct(), Vect_get_area_points(), Vect_get_isle_points(), Vect_line_prune(), Vect_new_line_struct(), line_pnts::x, and line_pnts::y.
Referenced by Vect_remove_small_areas_ext(), and Vect_remove_small_areas_nat().
Creates list of boundaries for given area.
Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for backward).
| Map | pointer to Map_info structure | |
| area | area id | |
| [out] | List | pointer to list of boundaries |
Definition at line 139 of file vector/Vlib/area.c.
References _, G_debug(), G_fatal_error(), P_area::lines, P_area::n_lines, NULL, Vect_list_append(), and Vect_reset_list().
Referenced by Vect_remove_small_areas_ext(), Vect_remove_small_areas_nat(), Vect_topo_check(), and Vedit_delete_area().
Find FIRST category of given field and area.
| Map | pointer to Map_info structure |
| area | area id |
| field | layer number |
Definition at line 449 of file vector/Vlib/area.c.
References line_cats::field, NULL, Vect_get_area_cats(), Vect_new_cats_struct(), and Vect_reset_cats().
Referenced by Vect__copy_areas(), Vect_write_ascii(), vector2perimeters(), and Vedit_delete_areas_cat().
Get area categories.
| Map | pointer to Map_info structure | |
| area | area id | |
| [out] | Cats | list of categories |
Definition at line 422 of file vector/Vlib/area.c.
References NULL, Vect_get_area_centroid(), Vect_read_line(), and Vect_reset_cats().
Referenced by Vect_get_area_cat(), and Vect_write_ascii().
Returns centroid id for given area.
| Map | pointer to Map_info structure |
| area | area id |
Definition at line 110 of file vector/Vlib/area.c.
References _, P_area::centroid, G_debug(), G_fatal_error(), and NULL.
Referenced by Vect__copy_areas(), Vect_build_partial(), Vect_get_area_cats(), Vect_overlay_and(), Vect_remove_small_areas_ext(), Vect_remove_small_areas_nat(), Vect_set_varray_from_cat_list(), Vect_set_varray_from_db(), Vect_topo_check(), and Vedit_delete_area().
Returns isle id for area.
| Map | pointer to Map_info structure |
| area | area id |
| isle | isle index (0 .. nisles - 1) |
Definition at line 236 of file vector/Vlib/area.c.
References _, G_debug(), G_fatal_error(), P_area::isles, and NULL.
Referenced by Vect__copy_areas(), Vect_area_buffer2(), Vect_get_point_in_area(), Vect_read_area_geos(), Vect_remove_small_areas_nat(), and Vect_write_ascii().
Returns number of isles for given area.
| Map | pointer to Map_info structure |
| area | area id |
Definition at line 208 of file vector/Vlib/area.c.
References _, G_debug(), G_fatal_error(), P_area::n_isles, and NULL.
Referenced by Vect__copy_areas(), Vect_area_buffer2(), Vect_get_point_in_area(), Vect_read_area_geos(), Vect_remove_small_areas_nat(), and Vect_write_ascii().
Returns perimeter of area with perimeter of isles.
| Map | pointer to Map_info structure |
| area | area id |
Definition at line 289 of file vector/Vlib/area.c.
References G_debug(), P_area::isles, P_area::n_isles, Vect_destroy_line_struct(), Vect_get_area_points(), Vect_get_isle_points(), Vect_line_geodesic_length(), Vect_line_prune(), and Vect_new_line_struct().
Returns polygon array of points (outer ring) of given area.
| Map | pointer to Map_info structure | |
| area | area id | |
| [out] | BPoints | points array |
Definition at line 37 of file vector/Vlib/area.c.
References _, G_debug(), G_warning(), P_area::lines, P_area::n_lines, NULL, Vect__get_area_points(), and Vect_reset_line().
Referenced by Gv_load_vect(), Vect__copy_areas(), Vect__load_plus_pg(), Vect_area_buffer2(), Vect_get_area_area(), Vect_get_area_perimeter(), Vect_get_point_in_area(), Vect_isle_find_area(), Vect_tin_get_z(), Vect_write_ascii(), and vector2perimeters().
Returns area id for isle.
| Map | vector |
| isle | isle number (0 .. nisles - 1) |
Definition at line 263 of file vector/Vlib/area.c.
References _, P_isle::area, G_debug(), G_fatal_error(), and NULL.
Referenced by Vect_remove_small_areas_nat(), Vect_select_areas_by_polygon(), Vect_topo_check(), and Vect_write_ascii().
Creates list of boundaries for given isle.
Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for forward).
| Map | pointer to Map_info structure | |
| isle | island number | |
| [out] | List | pointer to list where boundaries are stored |
Definition at line 175 of file vector/Vlib/area.c.
References _, G_debug(), G_fatal_error(), P_isle::lines, P_isle::n_lines, NULL, Vect_list_append(), and Vect_reset_list().
Referenced by Vect_remove_small_areas_nat().
Returns polygon array of points for given isle.
| Map | pointer to Map_info structure | |
| isle | island id | |
| [out] | BPoints | points array |
Definition at line 68 of file vector/Vlib/area.c.
References _, G_debug(), G_fatal_error(), G_warning(), GV_FORMAT_POSTGIS, P_isle::lines, P_isle::n_lines, NULL, Vect__get_area_points_nat(), Vect__get_area_points_pg(), and Vect_reset_line().
Referenced by Vect__copy_areas(), Vect__load_plus_pg(), Vect_area_buffer2(), Vect_find_island(), Vect_get_area_area(), Vect_get_area_perimeter(), Vect_get_point_in_area(), and Vect_write_ascii().
| int Vect_point_in_area | ( | double | x, |
| double | y, | ||
| struct Map_info * | Map, | ||
| int | area, | ||
| struct bound_box * | box | ||
| ) |
Check if point is in area.
| x,y | point coordinates |
| Map | pointer to Map_info structure |
| area | area id |
| box | area bounding box |
Definition at line 333 of file vector/Vlib/area.c.
References P_area::isles, P_area::n_isles, NULL, Vect_get_isle_box(), Vect_point_in_area_outer_ring(), Vect_point_in_island(), and x.