GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
|
Vector library - write vector feature (PostGIS format) More...
#include <string.h>
#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 | WKBSRIDFLAG 0x20000000 |
#define | TOPOGEOM_COLUMN "topo" |
#define | USE_TOPO_STMT 0 |
Functions | |
off_t | V1_write_line_pg (struct Map_info *Map, int type, const struct line_pnts *points, const struct line_cats *cats) |
Writes feature on level 1 (PostGIS interface) More... | |
off_t | V2_write_line_pg (struct Map_info *Map, int type, const struct line_pnts *points, const struct line_cats *cats) |
Writes feature on topological level (PostGIS interface) More... | |
off_t | V1_rewrite_line_pg (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 (level 1) (PostGIS interface, internal use only) More... | |
off_t | V2_rewrite_line_pg (struct Map_info *Map, off_t line, int type, const struct line_pnts *points, const struct line_cats *cats) |
Rewrites feature at topological level (PostGIS interface, internal use only) More... | |
int | V1_delete_line_pg (struct Map_info *Map, off_t offset) |
Deletes feature at the given offset (level 1) More... | |
int | V2_delete_line_pg (struct Map_info *Map, off_t line) |
Deletes feature on topological level (PostGIS interface) More... | |
off_t | V2__write_node_pg (struct Map_info *Map, const struct line_pnts *points) |
Writes node on topological level (PostGIS Topology interface, internal use only) More... | |
off_t | V2__write_area_pg (struct Map_info *Map, const struct line_pnts **points, int nparts, const struct line_cats *cats) |
Writes area on topological level (PostGIS Simple Features interface, internal use only) More... | |
int | V2__update_area_pg (struct Map_info *Map, const struct line_pnts **points, int nparts, int cat) |
Updates simple features geometry from GRASS-like topo. More... | |
int | Vect__define_topo_relation (const struct Format_info_pg *pg_info, int topo_id, int element_id) |
int | Vect__insert_face_pg (struct Map_info *Map, int area) |
Insert new face to the 'face' table (topo only) More... | |
Vector library - write vector feature (PostGIS format)
Higher level functions for reading/writing/manipulating vectors.
Write subroutine inspired by OGR PostgreSQL driver.
PostGIS version of V2__delete_area_cats_from_cidx_nat()
function to delete corresponding entry in fidx
PostGIS version of V2__add_area_cats_to_cidx_nat
(C) 2012-2014 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.
Definition in file write_pg.c.
#define TOPOGEOM_COLUMN "topo" |
Definition at line 34 of file write_pg.c.
#define USE_TOPO_STMT 0 |
Use SQL statements from PostGIS Topology extension (this options is quite slow. By default are used simple SQL statements (INSERT, UPDATE)
Definition at line 39 of file write_pg.c.
#define WKBSRIDFLAG 0x20000000 |
Definition at line 32 of file write_pg.c.
int V1_delete_line_pg | ( | struct Map_info * | Map, |
off_t | offset | ||
) |
Deletes feature at the given offset (level 1)
Only for simple feature access. PostGIS Topology requires level 2.
Map | pointer Map_info structure |
offset | feature offset |
Definition at line 311 of file write_pg.c.
References _, Format_info_offset::array, Format_info_offset::array_num, Format_info_pg::conn, DB_SQL_MAX, Format_info_pg::fid_column, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Format_info_pg::inTransaction, Format_info_pg::offset, Format_info::pg, PRI_OFF_T, Format_info_pg::table_name, TRUE, and Vect__execute_pg().
off_t V1_rewrite_line_pg | ( | 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 (level 1) (PostGIS interface, internal use only)
Only for simple feature access. PostGIS Topology requires level 2.
Map | pointer to Map_info structure |
offset | feature offset |
type | feature type (GV_POINT, GV_LINE, ...) |
points | feature geometry |
cats | feature categories |
Definition at line 179 of file write_pg.c.
off_t V1_write_line_pg | ( | struct Map_info * | Map, |
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Writes feature on level 1 (PostGIS interface)
Notes for simple feature access:
Notes for PostGIS Topology access:
Map | pointer to Map_info structure |
type | feature type (GV_POINT, GV_LINE, ...) |
points | pointer to line_pnts structure (feature geometry) |
cats | pointer to line_cats structure (feature categories) |
Definition at line 99 of file write_pg.c.
int V2__update_area_pg | ( | struct Map_info * | Map, |
const struct line_pnts ** | points, | ||
int | nparts, | ||
int | cat | ||
) |
Updates simple features geometry from GRASS-like topo.
Map | pointer to Map_info structure |
points | feature geometry (exterior + interior rings) |
nparts | number of parts including exterior ring |
cat | area category |
Definition at line 539 of file write_pg.c.
References _, Map_info::fInfo, G_warning(), line_pnts::n_points, Format_info::pg, and x.
off_t V2__write_area_pg | ( | struct Map_info * | Map, |
const struct line_pnts ** | points, | ||
int | nparts, | ||
const struct line_cats * | cats | ||
) |
Writes area on topological level (PostGIS Simple Features interface, internal use only)
Map | pointer to Map_info structure |
points | feature geometry (exterior + interior rings) |
nparts | number of parts including exterior ring |
cats | feature categories |
Definition at line 521 of file write_pg.c.
Referenced by V2__write_area_sfa().
Writes node on topological level (PostGIS Topology interface, internal use only)
The vector map must be open on level 2 at least with GV_BUILD_BASE. PostGIS Topology schema must be defined.
Map | pointer to Map_info structure |
node | node id (starts at 1) |
points | pointer to line_pnts structure |
Definition at line 497 of file write_pg.c.
References Map_info::fInfo, Format_info::pg, and Format_info_pg::toposchema_name.
int V2_delete_line_pg | ( | struct Map_info * | Map, |
off_t | line | ||
) |
Deletes feature on topological level (PostGIS interface)
Note: Topology must be built at level >= GV_BUILD_BASE
Calls V2_delete_line_sfa() for simple feature access.
Map | pointer to Map_info structure |
line | feature id to be deleted |
Definition at line 373 of file write_pg.c.
off_t V2_rewrite_line_pg | ( | struct Map_info * | Map, |
off_t | line, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Rewrites feature at topological level (PostGIS interface, internal use only)
Note: Topology must be built at level >= GV_BUILD_BASE
Handle also categories
Store original geometry in tmp table for restore
Map | pointer to Map_info structure |
line | feature id |
type | feature type (GV_POINT, GV_LINE, ...) |
points | feature geometry |
cats | feature categories |
Definition at line 219 of file write_pg.c.
off_t V2_write_line_pg | ( | struct Map_info * | Map, |
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Writes feature on topological level (PostGIS interface)
Calls V2_write_line_sfa() for simple features access.
Map | pointer to Map_info structure |
type | feature type (GV_POINT, GV_LINE, ...) |
points | pointer to line_pnts structure (feature geometry) |
cats | pointer to line_cats structure (feature categories) |
Definition at line 142 of file write_pg.c.
int Vect__define_topo_relation | ( | const struct Format_info_pg * | pg_info, |
int | topo_id, | ||
int | element_id | ||
) |
Definition at line 2367 of file write_pg.c.
References DB_SQL_MAX.
int Vect__insert_face_pg | ( | struct Map_info * | Map, |
int | area | ||
) |
Insert new face to the 'face' table (topo only)
Map | pointer to Map_info struct |
area | area id (negative id for isles) |
Definition at line 2497 of file write_pg.c.
References Format_info_pg::conn, bound_box::E, Map_info::fInfo, G_asprintf(), G_debug(), G_free(), bound_box::N, NULL, Format_info::pg, bound_box::S, Format_info_pg::srid, Format_info_pg::toposchema_name, Vect__execute_pg(), Vect_get_area_box(), Vect_get_isle_box(), and bound_box::W.