GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
Vector library - write vector feature (PostGIS format) More...
#include <inttypes.h>
#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 |
#define | NOPG_UNUSED |
Functions | |
off_t | V1_write_line_pg (struct Map_info *Map NOPG_UNUSED, int type NOPG_UNUSED, const struct line_pnts *points NOPG_UNUSED, const struct line_cats *cats NOPG_UNUSED) |
Writes feature on level 1 (PostGIS interface) More... | |
off_t | V2_write_line_pg (struct Map_info *Map NOPG_UNUSED, int type NOPG_UNUSED, const struct line_pnts *points NOPG_UNUSED, const struct line_cats *cats NOPG_UNUSED) |
Writes feature on topological level (PostGIS interface) More... | |
off_t | V1_rewrite_line_pg (struct Map_info *Map NOPG_UNUSED, off_t offset, int type, const struct line_pnts *points NOPG_UNUSED, const struct line_cats *cats NOPG_UNUSED) |
Rewrites feature at the given offset (level 1) (PostGIS interface, internal use only) More... | |
off_t | V2_rewrite_line_pg (struct Map_info *Map NOPG_UNUSED, off_t line, int type, const struct line_pnts *points NOPG_UNUSED, const struct line_cats *cats UNUSED) |
Rewrites feature at topological level (PostGIS interface, internal use only) More... | |
int | V1_delete_line_pg (struct Map_info *Map NOPG_UNUSED, off_t offset NOPG_UNUSED) |
Deletes feature at the given offset (level 1) More... | |
int | V2_delete_line_pg (struct Map_info *Map NOPG_UNUSED, off_t line NOPG_UNUSED) |
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 NOPG_UNUSED |
Definition at line 83 of file write_pg.c.
#define TOPOGEOM_COLUMN "topo" |
Definition at line 35 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 40 of file write_pg.c.
#define WKBSRIDFLAG 0x20000000 |
Definition at line 33 of file write_pg.c.
int V1_delete_line_pg | ( | struct Map_info *Map | NOPG_UNUSED, |
off_t offset | NOPG_UNUSED | ||
) |
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 324 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, G_debug(), G_fatal_error(), G_warning(), Format_info_pg::inTransaction, Format_info_pg::offset, Format_info_pg::table_name, TRUE, and Vect__execute_pg().
off_t V1_rewrite_line_pg | ( | struct Map_info *Map | NOPG_UNUSED, |
off_t | offset, | ||
int | type, | ||
const struct line_pnts *points | NOPG_UNUSED, | ||
const struct line_cats *cats | NOPG_UNUSED | ||
) |
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 190 of file write_pg.c.
off_t V1_write_line_pg | ( | struct Map_info *Map | NOPG_UNUSED, |
int type | NOPG_UNUSED, | ||
const struct line_pnts *points | NOPG_UNUSED, | ||
const struct line_cats *cats | NOPG_UNUSED | ||
) |
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 109 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 557 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 540 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 516 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 | NOPG_UNUSED, |
off_t line | NOPG_UNUSED | ||
) |
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 387 of file write_pg.c.
off_t V2_rewrite_line_pg | ( | struct Map_info *Map | NOPG_UNUSED, |
off_t | line, | ||
int | type, | ||
const struct line_pnts *points | NOPG_UNUSED, | ||
const struct line_cats *cats | UNUSED | ||
) |
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 (unused) |
Definition at line 229 of file write_pg.c.
off_t V2_write_line_pg | ( | struct Map_info *Map | NOPG_UNUSED, |
int type | NOPG_UNUSED, | ||
const struct line_pnts *points | NOPG_UNUSED, | ||
const struct line_cats *cats | NOPG_UNUSED | ||
) |
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 152 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 2416 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 2563 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.