28#include "local_proto.h"
35#if !defined HAVE_POSTGRES
38 G_fatal_error(
_(
"Requested format is not compiled in this version"));
55static void unlink_file(
struct Map_info *,
const char *);
71 "Vect_close(): name = %s, mapset = %s, format = %d, level = %d, "
75 if (
Map->temporary && (
Map->fInfo.ogr.dsn ||
Map->fInfo.pg.conninfo)) {
79 putenv(
"GRASS_VECTOR_EXTERNAL_IMMEDIATE=1");
81 G_warning(
_(
"Unable to create vector map <%s>"),
106 putenv(
"GRASS_VECTOR_EXTERNAL_IMMEDIATE=");
115 if (
getenv(
"GRASS_VECTOR_PGFILE"))
192 if (
Map->plus.spidx_fp.file &&
Map->plus.Spidx_built ==
TRUE &&
195 G_debug(1,
"spatial index file closed");
200 if (
Map->level > 1 &&
Map->plus.release_support) {
201 G_debug(1,
"free topology, spatial index, and category index");
205 G_debug(1,
"close history file");
210 if (!
Map->head_only) {
243 G_warning(
_(
"Invalid request for writing frmt file - map format is %d"),
257 fprintf(fd,
"format: postgis\n");
258 fprintf(fd,
"conninfo: %s\n",
Map->fInfo.pg.conninfo);
259 fprintf(fd,
"schema: %s\n",
Map->fInfo.pg.schema_name);
260 fprintf(fd,
"table: %s\n",
Map->fInfo.pg.table_name);
262 G_fatal_error(
_(
"GRASS is not compiled with PostgreSQL support"));
269 fprintf(fd,
"layer: %s\n",
Map->fInfo.ogr.layer_name);
AMI_err name(char **stream_name)
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
void void G_verbose_message(const char *,...) __attribute__((format(printf
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
const char * G_find_file2(const char *, const char *, const char *)
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch)
const char * G_find_key_value(const char *, const struct Key_Value *)
Find given key (case sensitive)
struct Key_Value * G_fread_key_value(FILE *)
Read key/values pairs from file.
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_store(const char *)
Copy string to allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf
const char * G_mapset(void)
Get current mapset name.
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
int Vect_cidx_save(struct Map_info *)
Save category index to binary file (cidx)
int Vect_coor_info(struct Map_info *, struct Coor_info *)
Update Coor_info structure.
int Vect_open_new(struct Map_info *, const char *, int)
Create new vector map for reading/writing.
int Vect_map_del_dblink(struct Map_info *, int)
Delete db connection from Map_info structure.
const char * Vect_get_name(struct Map_info *)
Get name of vector map.
int Vect_copy_map_lines_field(struct Map_info *, int, struct Map_info *)
Copy all alive vector features from given layer from input vector map to output vector map.
int V2_close_pg(struct Map_info *)
Close vector map (PostGIS layer) on topological level (write out fidx file)
int V1_close_nat(struct Map_info *)
Close vector map.
int Vect_save_topo(struct Map_info *)
Save topology file for vector map.
int Vect_save_sidx(struct Map_info *)
Save spatial index file for vector map.
int Vect_copy_head_data(struct Map_info *, struct Map_info *)
Copy header data from one to another map.
int Vect_hist_copy(struct Map_info *, struct Map_info *)
Copy history from one map to another.
const char * Vect_get_full_name(struct Map_info *)
Get fully qualified name of vector map.
void Vect_copy_map_dblinks(struct Map_info *, struct Map_info *, int)
Copy DB links from input vector map to output vector map.
int Vect_build(struct Map_info *)
Build topology for vector map.
int V1_close_ogr(struct Map_info *)
Close vector map (OGR dsn & layer) on level 1.
int V1_close_pg(struct Map_info *)
Close vector map (PostGIS layer) on level 1.
int V2_close_ogr(struct Map_info *)
Close vector map on topological level (write out fidx file)
int Vect_is_3d(struct Map_info *)
Check if vector map is 3D.
#define VECT_CLOSED_CODE
Vector map close code.
#define GV_FRMT_ELEMENT
Format description, data location (OGR)
#define GV_FORMAT_POSTGIS
PostGIS format.
#define GV_DIRECTORY
Name of vector directory.
#define GV_SIDX_ELEMENT
Native format, spatial index.
#define GV_BUILD_ALL
Topology levels - build everything (currently same as GV_BUILD_CENTROIDS)
#define GV_FIDX_ELEMENT
External format (OGR), feature index.
#define GV_CIDX_ELEMENT
Native format, category index.
#define GV_TOPO_ELEMENT
Native format, topology file.
#define GV_FORMAT_OGR
OGR format.
void dig_free_plus(struct Plus_head *)
Free Plus structure.
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int format
Map format (native, ogr, postgis)
int Vect_close(struct Map_info *Map)
Close vector map.
void Vect__free_offset(struct Format_info_offset *offset)
int Vect_save_frmt(struct Map_info *Map)
Save format definition file for vector map.
void Vect__free_cache(struct Format_info_cache *cache)
char * Vect__get_element_path(char *file_path, struct Map_info *Map, const char *element)
Get map element full path (internal use only)