|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
|
Vector library - Copy vector features and attribute tables linked to the map. More...
#include <grass/vector.h>#include <grass/glocale.h>#include "local_proto.h"#include "pg_local_proto.h"
Go to the source code of this file.
Macros | |
| #define | TOPO_NONE -1 |
| Copy topological elements. | |
| #define | TOPO_NATIVE 1 |
| #define | TOPO_POSTGIS 2 |
| #define | NOPG_UNUSED |
Functions | |
| int | Vect_copy_map_lines (struct Map_info *In, struct Map_info *Out) |
| Copy all alive vector features from input vector map to output vector map. | |
| int | Vect_copy_map_lines_field (struct Map_info *In, int field, struct Map_info *Out) |
| Copy all alive vector features from given layer from input vector map to output vector map. | |
| int | Vect__copy_areas (struct Map_info *In, int field, struct Map_info *Out) |
| Copy areas as polygons (OGR/PostGIS simple features access only) | |
| int | Vect_copy_tables (struct Map_info *In, struct Map_info *Out, int field) |
| Copy attribute tables linked to vector map. | |
| int | Vect_copy_table (struct Map_info *In, struct Map_info *Out, int field_in, int field_out, const char *field_name, int type) |
| Copy attribute table linked to vector map based on type. | |
| int | Vect_copy_table_by_cat_list (struct Map_info *In, struct Map_info *Out, int field_in, int field_out, const char *field_name, int type, const struct cat_list *cat_list) |
| Copy attribute table linked to vector map based on category list. | |
| int | Vect_copy_table_by_cats (struct Map_info *In, struct Map_info *Out, int field_in, int field_out, const char *field_name, int type, int *cats, int ncats) |
| Copy attribute table linked to vector map based on category numbers. | |
Vector library - Copy vector features and attribute tables linked to the map.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2009, 2012-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/copy.c.
| #define NOPG_UNUSED |
Definition at line 38 of file vector/Vlib/copy.c.
| #define TOPO_NATIVE 1 |
Definition at line 33 of file vector/Vlib/copy.c.
| #define TOPO_NONE -1 |
Copy topological elements.
Definition at line 32 of file vector/Vlib/copy.c.
| #define TOPO_POSTGIS 2 |
Definition at line 34 of file vector/Vlib/copy.c.
Copy areas as polygons (OGR/PostGIS simple features access only)
| In | input vector map |
| field | layer number (-1 for all layers) |
| Out | output vector map |
Definition at line 509 of file vector/Vlib/copy.c.
References _, G_debug(), G_free(), G_important_message(), G_malloc, G_message(), G_percent(), G_realloc, G_warning(), V2__update_area_pg(), V2__write_area_sfa(), Vect_cat_set(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_get_area_cat(), Vect_get_area_centroid(), Vect_get_area_isle(), Vect_get_area_num_isles(), Vect_get_area_points(), Vect_get_isle_points(), Vect_get_num_areas(), Vect_new_cats_struct(), Vect_new_line_struct(), and Vect_reset_cats().
Referenced by Vect_copy_map_lines_field().
Copy all alive vector features from input vector map to output vector map.
| In | input vector map | |
| [out] | Out | output vector map |
Definition at line 63 of file vector/Vlib/copy.c.
References Vect_copy_map_lines_field().
Copy all alive vector features from given layer from input vector map to output vector map.
Note: Try to copy on level 2 otherwise level 1 is used.
| In | input vector map | |
| field | layer number (-1 for all layers) | |
| [out] | Out | output vector map |
Definition at line 81 of file vector/Vlib/copy.c.
References _, Map_info::fInfo, Map_info::format, G_fatal_error(), G_free(), G_warning(), GV_FORMAT_NATIVE, GV_FORMAT_POSTGIS, GV_LINES, GV_POINTS, NULL, TOPO_NATIVE, TOPO_NONE, TOPO_POSTGIS, Vect__copy_areas(), Vect_get_finfo_geometry_type(), Vect_get_finfo_layer_name(), Vect_get_full_name(), Vect_level(), Vect_read_next_line(), Vect_rewind(), Vect_set_constraint_type(), and Vect_write_line().
Referenced by Vect_close(), and Vect_copy_map_lines().
| int Vect_copy_table | ( | struct Map_info * | In, |
| struct Map_info * | Out, | ||
| int | field_in, | ||
| int | field_out, | ||
| const char * | field_name, | ||
| int | type | ||
| ) |
Copy attribute table linked to vector map based on type.
| In | input vector map | |
| [out] | Out | output vector map |
| field_in | input layer number | |
| field_out | output layer number | |
| field_name | layer name (can be NULL) | |
| type | how many tables are linked to map: GV_1TABLE / GV_MTABLE |
Definition at line 686 of file vector/Vlib/copy.c.
References NULL, and Vect_copy_table_by_cats().
Referenced by Vect_copy_table_by_cat_list(), and Vect_copy_tables().
| int Vect_copy_table_by_cat_list | ( | struct Map_info * | In, |
| struct Map_info * | Out, | ||
| int | field_in, | ||
| int | field_out, | ||
| const char * | field_name, | ||
| int | type, | ||
| const struct cat_list * | cat_list | ||
| ) |
Copy attribute table linked to vector map based on category list.
If cat_list is NULL, then Vect_copy_table() is called.
| In | input vector map | |
| [out] | Out | output vector map |
| field_in | input layer number | |
| field_out | output layer number | |
| field_name | layer name (can be NULL) | |
| type | how many tables are linked to map: GV_1TABLE / GV_MTABLE | |
| cat_list | pointer to cat_list struct (can be NULL) |
Definition at line 710 of file vector/Vlib/copy.c.
References G_free(), Vect_cat_list_to_array(), Vect_copy_table(), and Vect_copy_table_by_cats().
| int Vect_copy_table_by_cats | ( | struct Map_info * | In, |
| struct Map_info * | Out, | ||
| int | field_in, | ||
| int | field_out, | ||
| const char * | field_name, | ||
| int | type, | ||
| int * | cats, | ||
| int | ncats | ||
| ) |
Copy attribute table linked to vector map based on category numbers.
| In | input vector map | |
| [out] | Out | output vector map |
| field_in | input layer number | |
| field_out | output layer number | |
| field_name | layer name (can be NULL) | |
| type | how many tables are linked to map: GV_1TABLE / GV_MTABLE | |
| cats | pointer to array of cats or NULL | |
| ncats | number of cats in 'cats' |
Definition at line 750 of file vector/Vlib/copy.c.
References _, db_close_database_shutdown_driver(), db_copy_table_by_ints(), db_create_index2(), DB_FAILED, db_grant_on_table(), DB_GROUP, DB_OK, DB_PRIV_SELECT, DB_PUBLIC, db_start_driver_open_database(), G_debug(), G_warning(), field_info::key, AMI_STREAM< T >::name(), Map_info::name, name, NULL, Vect_default_field_info(), Vect_destroy_field_info(), Vect_get_field(), Vect_map_add_dblink(), and Vect_subst_var().
Referenced by Vect_copy_table(), and Vect_copy_table_by_cat_list().
Copy attribute tables linked to vector map.
Copy all attribute tables linked to the vector map if field is 0, or selected attribute table defined by given field if field > 0.
Notice, that if input vector map has no tables defined, it will copy nothing and return 0 (success).
| In | input vector map | |
| [out] | Out | output vector map |
| field | layer number (0 for all tables linked to the vector map) |
Definition at line 632 of file vector/Vlib/copy.c.
References _, Map_info::dblnk, G_debug(), G_free(), G_warning(), GV_1TABLE, GV_MTABLE, AMI_STREAM< T >::name(), NULL, Vect_copy_table(), Vect_destroy_field_info(), Vect_get_dblink(), Vect_get_full_name(), Vect_get_name(), and Vect_get_num_dblinks().
Referenced by Vect_copy().