GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72846
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
open_pg.c File Reference

Vector library - Open PostGIS layer as vector map layer. More...

#include <string.h>
#include <stdlib.h>
#include <grass/vector.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>
#include "local_proto.h"
Include dependency graph for open_pg.c:

Go to the source code of this file.


int V1_open_old_pg (struct Map_info *Map, int update)
 Open vector map - PostGIS feature table on non-topological level. More...
int V2_open_old_pg (struct Map_info *Map)
 Open vector map - PostGIS feature table on topological level. More...
int V1_open_new_pg (struct Map_info *Map, const char *name, int with_z)
 Prepare PostGIS database for creating new feature table (level 1) More...
int Vect__open_topo_pg (struct Map_info *Map, int head_only, int update)
 Read full-topology for PostGIS links. More...

Detailed Description

Vector library - Open PostGIS layer as vector map layer.

Higher level functions for reading/writing/manipulating vectors.

(C) 2011-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.

Martin Landa <landa.martin>

Definition in file open_pg.c.

Function Documentation

int V1_open_new_pg ( struct Map_info Map,
const char *  name,
int  with_z 

Prepare PostGIS database for creating new feature table (level 1)

New PostGIS table is created when writing features by Vect_wrile_line().

[out]Mappointer to Map_info structure
namename of PostGIS feature table to create
with_zWITH_Z for 3D vector data otherwise WITHOUT_Z
0 success
-1 error

Definition at line 219 of file open_pg.c.

References _, Format_info_pg::cache, Format_info_pg::conn, Format_info_pg::conninfo, Format_info_pg::db_name, DB_SQL_MAX, Format_info_pg::feature_type, Format_info_cache::fid, Format_info_pg::fid_column, Map_info::fInfo, G_debug(), G_fatal_error(), G_get_overwrite(), G_store(), G_warning(), Format_info_pg::geom_column, GV_PG_FID_COLUMN, GV_PG_GEOMETRY_COLUMN, Format_info::pg, Format_info_pg::res, Format_info_pg::schema_name, SF_GEOMETRY, and Format_info_pg::table_name.

int V1_open_old_pg ( struct Map_info Map,
int  update 
int V2_open_old_pg ( struct Map_info Map)

Open vector map - PostGIS feature table on topological level.

Simple feature access:

  • open feature index file PostGIS Topology:
  • check if topological schema exists
[in,out]Mappointer to Map_info structure
0 success
-1 error

Definition at line 161 of file open_pg.c.

References _, Format_info_pg::conn, DB_SQL_MAX, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), G_zero(), Map_info::mapset, Map_info::name, Format_info_pg::offset, Format_info::pg, Format_info_pg::res, Format_info_pg::toposchema_id, Format_info_pg::toposchema_name, Vect_get_full_name(), and Vect_open_fidx().

Referenced by Vect__open_old().

int Vect__open_topo_pg ( struct Map_info Map,
int  head_only,
int  update 

Read full-topology for PostGIS links.

Note: Only 2D topological primitives are currently supported

[in,out]Mappointer to Map_info structure
head_onlyTRUE to read only header
updateTRUE to clean GRASS topology in update mode
0 on success
1 topology layer does not exist
-1 on error

Definition at line 317 of file open_pg.c.

References _, Plus_head::cidx_up_to_date, dig_init_plus(), FALSE, Map_info::fInfo, G_fatal_error(), Map_info::open, Format_info::pg, Map_info::plus, Plus_head::Spidx_new, Map_info::support_updated, TRUE, Plus_head::update_cidx, and VECT_OPEN_CODE.

Referenced by Vect__open_old().