GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
write_ogr.c File Reference

Vector library - write vector feature (OGR format) More...

#include <grass/vector.h>
#include <grass/dbmi.h>
#include <grass/gprojects.h>
#include <grass/glocale.h>
#include <ogr_api.h>
#include <cpl_string.h>
Include dependency graph for write_ogr.c:

Go to the source code of this file.

Functions

off_t V1_write_line_ogr (struct Map_info *Map, int type, const struct line_pnts *points, const struct line_cats *cats)
 Writes feature on level 1 (OGR interface) More...
 
off_t V1_rewrite_line_ogr (struct Map_info *Map, off_t offset, int type, const struct line_pnts *points, const struct line_cats *cats)
 Rewrites feature at the given offset on level 1 (OGR interface) More...
 
int V1_delete_line_ogr (struct Map_info *Map, off_t offset)
 Deletes feature at the given offset on level 1 (OGR interface) More...
 
off_t V2__write_area_ogr (struct Map_info *Map, const struct line_pnts **points, int nparts, const struct line_cats *cats)
 Writes area on topological level (OGR Simple Features interface, internal use only) More...
 

Detailed Description

Vector library - write vector feature (OGR format)

Higher level functions for reading/writing/manipulating vectors.

Partly inspired by v.out.ogr's code.

Todo:
How to deal with OGRNullFID

(C) 2009-2013 by Martin Landa, and 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
Martin Landa <landa.martin gmail.com>

Definition in file write_ogr.c.

Function Documentation

◆ V1_delete_line_ogr()

int V1_delete_line_ogr ( struct Map_info Map,
off_t  offset 
)

Deletes feature at the given offset on level 1 (OGR interface)

Parameters
Mappointer Map_info structure
offsetoffset of feature to be deleted
Returns
0 on success
-1 on error

Definition at line 119 of file write_ogr.c.

References _, Format_info_offset::array, Format_info_offset::array_num, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Format_info_ogr::layer, Format_info_ogr::offset, Format_info::ogr, and PRI_OFF_T.

◆ V1_rewrite_line_ogr()

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

Rewrites feature at the given offset on level 1 (OGR interface)

This function simply calls V1_delete_line_ogr() and V1_write_line_ogr().

Parameters
Mappointer to Map_info structure
offsetfeature offset
typefeature type (see V1_write_line_ogr() for supported types)
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
feature offset (rewritten feature)
-1 on error

Definition at line 88 of file write_ogr.c.

◆ V1_write_line_ogr()

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

Writes feature on level 1 (OGR interface)

Note:

  • centroids are not supported in OGR, pseudotopo holds virtual centroids (it's coordinates determined from spatial index)
  • unclosed boundaries are not supported in OGR, pseudotopo treats polygons as boundaries

Supported feature types:

  • GV_POINT (written as wkbPoint)
  • GV_LINE (wkbLineString)
  • GV_BOUNDARY (wkbPolygon)
  • GV_FACE (wkbPolygon25D)
  • GV_KERNEL (wkbPoint25D)
Parameters
Mappointer to Map_info structure
typefeature type
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
feature index in offset array (related to pseudo-topology)
-1 on error

Definition at line 62 of file write_ogr.c.

◆ V2__write_area_ogr()

off_t V2__write_area_ogr ( struct Map_info Map,
const struct line_pnts **  points,
int  nparts,
const struct line_cats cats 
)

Writes area on topological level (OGR Simple Features interface, internal use only)

Parameters
Mappointer to Map_info structure
pointsfeature geometry (exterior + interior rings)
npartsnumber of parts including exterior ring
catsfeature categories
Returns
feature offset
-1 on error

Definition at line 164 of file write_ogr.c.

Referenced by V2__write_area_sfa().