GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
Vector library - Manipulate with vector map. More...
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <grass/glocale.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/dbmi.h>
Go to the source code of this file.
Functions | |
int | Vect_copy_map_lines (struct Map_info *In, struct Map_info *Out) |
Copy all alive elements of opened vector map to another opened vector map. More... | |
int | Vect_copy (const char *in, const char *mapset, const char *out) |
Copy a map including attribute tables. More... | |
int | Vect_rename (const char *in, const char *out) |
Rename a map. More... | |
int | Vect_delete (const char *map) |
Delete vector map including attribute tables. More... | |
int | Vect_copy_tables (struct Map_info *In, struct Map_info *Out, int field) |
Copy tables linked to vector map. More... | |
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 table linked to vector map based on type. More... | |
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 table linked to vector map based on category numbers. More... | |
void | Vect_set_release_support (struct Map_info *Map) |
Set spatial index to be realease when vector is closed. More... | |
void | Vect_set_category_index_update (struct Map_info *Map) |
By default, category index is not updated if vector is changed, this function sets category index update. More... | |
Vector library - Manipulate with vector map.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2008 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 map.c.
int Vect_copy | ( | const char * | in, |
const char * | mapset, | ||
const char * | out | ||
) |
Copy a map including attribute tables.
Old vector is deleted
[in] | in | input vector map name |
[in] | mapset | mapset name |
[in] | out | output vector map name |
Definition at line 159 of file map.c.
References db_close_database_shutdown_driver(), db_copy_table(), db_create_index2(), db_start_driver_open_database(), driver, G__file_name(), G__make_mapset_element(), G_debug(), G_fatal_error(), G_find_vector2(), G_mapset(), G_warning(), n, NULL, sprintf(), stat, dialogs::type, Vect_close(), Vect_default_field_info(), Vect_delete(), Vect_get_dblink(), Vect_get_num_dblinks(), Vect_legal_filename(), Vect_map_add_dblink(), Vect_open_old_head(), Vect_open_update_head(), Vect_set_open_level(), Vect_subst_var(), and xmapset.
int Vect_copy_map_lines | ( | struct Map_info * | In, |
struct Map_info * | Out | ||
) |
Copy all alive elements of opened vector map to another opened vector map.
[in] | In | input vector map |
[out] | Out | output vector map |
Definition at line 44 of file map.c.
References G_fatal_error(), G_warning(), dialogs::type, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_get_full_name(), Vect_get_num_lines(), Vect_level(), Vect_line_alive(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_read_next_line(), Vect_rewind(), and Vect_write_line().
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 table linked to vector map based on type.
[in] | In | input vector map |
[out] | Out | output vector map |
[in] | field_in | input layer number |
[in] | field_out | output layer number |
[in] | field_name | layer name |
[in] | type | feature type |
Definition at line 650 of file map.c.
References NULL, 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 table linked to vector map based on category numbers.
[in] | In | input vector map |
[out] | Out | output vector map |
[in] | field_in | input layer number |
[in] | field_out | output layer number |
[in] | field_name | layer name |
[in] | type | feature type |
[in] | cats | pointer to array of cats or NULL |
[in] | ncats | number of cats in 'cats' |
Definition at line 673 of file map.c.
References db_copy_table_by_ints(), G_debug(), G_warning(), render::name, NULL, Vect_default_field_info(), Vect_get_field(), Vect_map_add_dblink(), and Vect_subst_var().
Referenced by Vect_copy_table().
Copy tables linked to vector map.
All if field = 0, or table defined by given field if field > 0 Notice, that if input map has no tables defined, it will copy nothing and return 0 (success).
[in] | In | input vector map |
[out] | Out | output vector map |
[in] | field | layer number |
Definition at line 571 of file map.c.
References db_close_database_shutdown_driver(), db_copy_table(), db_create_index2(), db_start_driver_open_database(), driver, G_debug(), G_warning(), n, NULL, dialogs::type, Vect_default_field_info(), Vect_get_dblink(), Vect_get_num_dblinks(), Vect_map_add_dblink(), and Vect_subst_var().
int Vect_delete | ( | const char * | map | ) |
Delete vector map including attribute tables.
[in] | map | vector map name |
Definition at line 431 of file map.c.
References db_delete_table(), db_table_exists(), G_debug(), G_gisdbase(), G_location(), G_location_path(), G_mapset(), G_tempfile(), G_warning(), n, NULL, opendir(), readdir(), sprintf(), Vect_close(), Vect_get_dblink(), Vect_get_num_dblinks(), Vect_open_old_head(), and Vect_set_open_level().
Referenced by Vect_copy(), Vect_open_new(), and Vect_rename().
int Vect_rename | ( | const char * | in, |
const char * | out | ||
) |
Rename a map.
Attribute tables are created in the same database where input tables were stored.
The original format (native/OGR) is used. Old map ('out') is deleted!!!
[in] | in | input vector map name |
[in] | out | output vector map name |
Definition at line 303 of file map.c.
References db_close_database_shutdown_driver(), db_copy_table(), db_create_index2(), db_delete_table(), db_start_driver_open_database(), driver, free(), G_debug(), G_fatal_error(), G_find_vector2(), G_mapset(), G_rename(), G_warning(), n, NULL, dialogs::type, Vect_close(), Vect_default_field_info(), Vect_delete(), Vect_get_dblink(), Vect_get_field(), Vect_get_num_dblinks(), Vect_legal_filename(), Vect_map_add_dblink(), Vect_map_del_dblink(), Vect_open_update_head(), Vect_set_open_level(), and Vect_subst_var().
void Vect_set_category_index_update | ( | struct Map_info * | Map | ) |