GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
vector/Vlib/write.c File Reference

Vector library - write vector features. More...

#include <inttypes.h>
#include <sys/types.h>
#include <grass/glocale.h>
#include <grass/vector.h>
Include dependency graph for vector/Vlib/write.c:

Go to the source code of this file.

Functions

off_t Vect_write_line (struct Map_info *Map, int type, const struct line_pnts *points, const struct line_cats *cats)
 Writes a new feature. More...
 
off_t Vect_rewrite_line (struct Map_info *Map, off_t line, int type, const struct line_pnts *points, const struct line_cats *cats)
 Rewrites existing feature (topological level required) More...
 
int Vect_delete_line (struct Map_info *Map, off_t line)
 Delete existing feature (topological level required) More...
 
int Vect_restore_line (struct Map_info *Map, off_t offset, off_t line)
 Restore previously deleted feature (topological level required) More...
 

Detailed Description

Vector library - write vector features.

Higher level functions for reading/writing/manipulating vectors.

Supported operations:

  • Write a new feature
  • Rewrite existing feature
  • Delete existing feature
  • Restore deleted feature

(C) 2001-2010, 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.

Author
Radim Blazek
Updated by Martin Landa <landa.martin gmail.com> (restore lines, OGR & PostGIS support)

Definition in file vector/Vlib/write.c.

Function Documentation

◆ Vect_delete_line()

int Vect_delete_line ( struct Map_info Map,
off_t  line 
)

Delete existing feature (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on error.

Parameters
Mappointer to Map_info structure
linefeature id (level 2) or feature offset (level 1)
Returns
0 on success
-1 on error

Definition at line 275 of file vector/Vlib/write.c.

◆ Vect_restore_line()

int Vect_restore_line ( struct Map_info Map,
off_t  offset,
off_t  line 
)

Restore previously deleted feature (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on error.

Parameters
Mappointer to Map_info structure
offsetfeature offset to be restored
linefeature id to be restored (used only on level 2)
Returns
0 on success
-1 on error

Definition at line 309 of file vector/Vlib/write.c.

◆ Vect_rewrite_line()

off_t Vect_rewrite_line ( struct Map_info Map,
off_t  line,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Rewrites existing feature (topological level required)

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on error.

The number of points or cats or type may change. If necessary, the old feature is deleted and new is written.

Parameters
Mappointer to Map_info structure
linefeature id (level 2) or feature offset (level 1)
typefeature type (GV_POINT, GV_LINE, ...)
pointsfeature geometry
catsfeature categories
Returns
new feature id (on level 2) (or 0 when build level < GV_BUILD_BASE)
offset into file where the feature starts (on level 1)
-1 on error

Definition at line 238 of file vector/Vlib/write.c.

◆ Vect_write_line()

off_t Vect_write_line ( struct Map_info Map,
int  type,
const struct line_pnts points,
const struct line_cats cats 
)

Writes a new feature.

New feature is written to the end of file (in the case of native format). Topological level is not required.

A warning is printed on error.

Parameters
Mappointer to Map_info structure
typefeature type (see dig_defines.h for supported types)
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
new feature id (on level 2) (or 0 when build level < GV_BUILD_BASE)
offset into file where the feature starts (on level 1)
-1 on error

Definition at line 196 of file vector/Vlib/write.c.

Referenced by IL_write_point_2d().