map.c File Reference

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>

Include dependency graph for map.c:

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.
int Vect_copy (const char *in, const char *mapset, const char *out)
 Copy a map including attribute tables.
int Vect_rename (const char *in, const char *out)
 Rename a map.
int Vect_delete (const char *map)
 Delete vector map including attribute tables.
int Vect_copy_tables (struct Map_info *In, struct Map_info *Out, int field)
 Copy 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 table linked to vector map based on type.
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.
void Vect_set_release_support (struct Map_info *Map)
 Set spatial index to be realease when vector is closed.
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.


Detailed Description

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.

Author:
Original author CERL, probably Dave Gerdes or Mike Higgins. Update to GRASS 5.7 Radim Blazek and David D. Gray.
Date:
2001-2008

Definition in file map.c.


Function Documentation

int Vect_copy ( const char *  in,
const char *  mapset,
const char *  out 
)

Copy a map including attribute tables.

Old vector is deleted

Parameters:
[in] in input vector map name
[in] mapset mapset name
[in] out output vector map name
Returns:
-1 error

0 success

Definition at line 156 of file map.c.

References 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(), and Vect_subst_var().

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.

Parameters:
[in] In input vector map
[out] Out output vector map
Returns:
0 on success

1 on error

Definition at line 44 of file map.c.

References Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_get_full_name(), Vect_get_num_lines(), Vect_level(), 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.

Parameters:
[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
Returns:
0 on success

-1 on error

Definition at line 646 of file map.c.

References 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.

Parameters:
[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'
Returns:
0 on success

-1 on error

Definition at line 669 of file map.c.

References Vect_default_field_info(), Vect_get_field(), Vect_map_add_dblink(), and Vect_subst_var().

Referenced by Vect_copy_table().

int Vect_copy_tables ( struct Map_info *  In,
struct Map_info *  Out,
int  field 
)

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).

Parameters:
[in] In input vector map
[out] Out output vector map
[in] field layer number
Returns:
0 on success

-1 on error

Definition at line 567 of file map.c.

References 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.

Parameters:
[in] map vector map name
Returns:
-1 error

0 success

Definition at line 428 of file map.c.

References 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!!!

Parameters:
[in] in input vector map name
[in] out output vector map name
Returns:
-1 error

0 success

Definition at line 300 of file map.c.

References 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  ) 

By default, category index is not updated if vector is changed, this function sets category index update.

WARNING: currently only category for elements is updated not for areas

Parameters:
Map vector map
Returns:

Definition at line 747 of file map.c.

void Vect_set_release_support ( struct Map_info *  Map  ) 

Set spatial index to be realease when vector is closed.

By default, the memory occupied by spatial index is not released.

Parameters:
Map vector map
Returns:

Definition at line 732 of file map.c.


Generated on Thu Jul 16 13:21:26 2009 for GRASS Programmer's Manual by  doxygen 1.5.6