41 G_warning(
_(
"GRASS is not compiled with OGR support"));
47 G_warning(
_(
"GRASS is not compiled with PostgreSQL support"));
52 G_debug(1,
"Native vector format detected for <%s>",
80 G_warning(
_(
"GRASS is not compiled with OGR support"));
86 G_warning(
_(
"GRASS is not compiled with PostgreSQL support"));
92 G_debug(1,
"Native vector format detected for <%s>",
113 G_warning(
_(
"GRASS is not compiled with OGR support"));
118 return OGR_Dr_GetName(OGR_DS_GetDriver(Map->
fInfo.
ogr.
ds));
123 G_warning(
_(
"GRASS is not compiled with PostgreSQL support"));
147 char *ftype, *ftype_tmp;
149 ftype_tmp = ftype =
NULL;
153 G_warning(
_(
"GRASS is not compiled with OGR support"));
155 OGRwkbGeometryType Ogr_geom_type;
156 OGRFeatureDefnH Ogr_feature_defn;
164 Ogr_geom_type = wkbFlatten(OGR_FD_GetGeomType(Ogr_feature_defn));
166 ftype_tmp =
G_store(OGRGeometryTypeToName(Ogr_geom_type));
170 #ifndef HAVE_POSTGRES 171 G_warning(
_(
"GRASS is not compiled with PostgreSQL support"));
180 sprintf(stmt,
"SELECT type,coord_dimension FROM geometry_columns " 181 "WHERE f_table_schema = '%s' AND f_table_name = '%s'",
185 res = PQexec(pg_info->
conn, stmt);
186 if (!res || PQresultStatus(res) != PGRES_TUPLES_OK ||
187 PQntuples(res) != 1) {
188 G_debug(1,
"Unable to get feature type: %s",
189 PQresultErrorMessage(res));
192 ftype_tmp =
G_store(PQgetvalue(res, 0, 0));
193 dim = atoi(PQgetvalue(res, 0, 1));
208 ftype_tmp = (
char *)
G_malloc(3 + strlen(ftype) + 1);
209 sprintf(ftype_tmp,
"3D %s", ftype);
231 return &(Map->
fInfo);
249 char **toposchema,
char **topogeom,
int* topo_geo_only)
254 G_warning(
_(
"GRASS is not compiled with OGR support"));
#define GV_FORMAT_OGR
OGR format.
void G_free(void *)
Free allocated memory.
struct Format_info fInfo
Format info for non-native formats.
char * G_str_replace(const char *, const char *, const char *)
Replace all occurrences of old_str in buffer with new_str.
#define GV_FORMAT_OGR_DIRECT
OGR format (direct access)
void G_str_to_lower(char *)
Convert string to lower case.
#define GV_TOPO_POSTGIS
PostGIS topology - external PostGIS format.
#define GV_FORMAT_POSTGIS
PostGIS format.
#define GV_TOPO_PSEUDO
Pseudo-topology - external simple features (OGR/PostGIS) format.
const char * Vect_get_full_name(const struct Map_info *)
Get fully qualified name of vector map.
void G_warning(const char *,...) __attribute__((format(printf
int format
Map format (native, ogr, postgis)
char * G_store(const char *)
Copy string to allocated memory.
int G_asprintf(char **, const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
#define GV_TOPO_NATIVE
GRASS topology - native format.