GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
header_finfo.c File Reference

Vector library - header manipulation (relevant for external formats) More...

#include <string.h>
#include <grass/vector.h>
#include <grass/glocale.h>
Include dependency graph for header_finfo.c:

Go to the source code of this file.

Functions

const char * Vect_get_finfo_dsn_name (const struct Map_info *Map)
 Get datasource name (relevant only for non-native formats) More...
 
char * Vect_get_finfo_layer_name (const struct Map_info *Map)
 Get layer name (relevant only for non-native formats) More...
 
const char * Vect_get_finfo_format_info (const struct Map_info *Map)
 Get format info as string (relevant only for non-native formats) More...
 
const char * Vect_get_finfo_geometry_type (const struct Map_info *Map)
 Get geometry type as string (relevant only for non-native formats) More...
 
const struct Format_infoVect_get_finfo (const struct Map_info *Map)
 Get header info for non-native formats. More...
 
int Vect_get_finfo_topology_info (const struct Map_info *Map, char **toposchema, char **topogeom, int *topo_geo_only)
 Get topology type (relevant only for non-native formats) More...
 

Detailed Description

Vector library - header manipulation (relevant for external formats)

Higher level functions for reading/writing/manipulating vectors.

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

Author
Original author CERL, probably Dave Gerdes or Mike Higgins.
Update to GRASS 5.7 Radim Blazek and David D. Gray.
Update to GRASS 7 (OGR/PostGIS support) by Martin Landa <landa.martin gmail.com>

Definition in file header_finfo.c.

Function Documentation

◆ Vect_get_finfo()

const struct Format_info* Vect_get_finfo ( const struct Map_info Map)

Get header info for non-native formats.

Parameters
Mappointer to Map_info structure
Returns
pointer to Format_info structure
NULL for native format

Definition at line 225 of file header_finfo.c.

References Format_info_pg::conninfo, Format_info_ogr::driver_name, Map_info::fInfo, NULL, Format_info::ogr, and Format_info::pg.

◆ Vect_get_finfo_dsn_name()

const char* Vect_get_finfo_dsn_name ( const struct Map_info Map)

Get datasource name (relevant only for non-native formats)

Returns:

  • datasource name for OGR format (GV_FORMAT_OGR and GV_FORMAT_OGR_DIRECT)
  • database name for PostGIS format (GV_FORMAT_POSTGIS)
Parameters
Mappointer to Map_info structure
Returns
string containing OGR/PostGIS datasource name
NULL on error (map format is native)

Definition at line 36 of file header_finfo.c.

References _, Format_info_pg::db_name, Format_info_ogr::dsn, Map_info::fInfo, Map_info::format, G_debug(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, NULL, Format_info::ogr, Format_info::pg, and Vect_get_full_name().

◆ Vect_get_finfo_format_info()

const char* Vect_get_finfo_format_info ( const struct Map_info Map)

Get format info as string (relevant only for non-native formats)

Parameters
Mappointer to Map_info structure
Returns
string containing name of OGR format
"PostgreSQL" for PostGIS format (GV_FORMAT_POSTGIS)
NULL on error (or on missing OGR/PostgreSQL support)

Definition at line 108 of file header_finfo.c.

References _, Format_info_ogr::ds, Map_info::fInfo, Map_info::format, G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, NULL, and Format_info::ogr.

Referenced by Vect_build_ogr(), and Vect_build_pg().

◆ Vect_get_finfo_geometry_type()

const char* Vect_get_finfo_geometry_type ( const struct Map_info Map)

Get geometry type as string (relevant only for non-native formats)

Note: All inner spaces are removed, function returns feature type in lowercase.

Parameters
Mappointer to Map_info structure
Returns
allocated string containing geometry type info (point, linestring, polygon, ...)
NULL on error (map format is native)

Definition at line 144 of file header_finfo.c.

References _, Format_info_pg::conn, DB_SQL_MAX, Map_info::fInfo, Map_info::format, G_debug(), G_free(), G_malloc, G_store(), G_str_replace(), G_str_to_lower(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer, NULL, Format_info::ogr, Format_info::pg, Format_info_pg::res, Format_info_pg::schema_name, and Format_info_pg::table_name.

Referenced by Vect_build_ogr(), Vect_build_pg(), and Vect_fidx_dump().

◆ Vect_get_finfo_layer_name()

char* Vect_get_finfo_layer_name ( const struct Map_info Map)

Get layer name (relevant only for non-native formats)

Returns:

  • layer name for OGR format (GV_FORMAT_OGR and GV_FORMAT_OGR_DIRECT)
  • table name for PostGIS format (GV_FORMAT_POSTGIS) including schema (<schema>.<table>)

Note: allocated string should be freed by G_free()

Parameters
Mappointer to Map_info structure
Returns
string containing layer name
NULL on error (map format is native)

Definition at line 72 of file header_finfo.c.

References _, Map_info::fInfo, Map_info::format, G_asprintf(), G_debug(), G_store(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer_name, name, NULL, Format_info::ogr, Format_info::pg, Format_info_pg::schema_name, Format_info_pg::table_name, and Vect_get_full_name().

◆ Vect_get_finfo_topology_info()

int Vect_get_finfo_topology_info ( const struct Map_info Map,
char **  toposchema,
char **  topogeom,
int *  topo_geo_only 
)

Get topology type (relevant only for non-native formats)

Parameters
Mappointer to Map_info structure
[out]toposchemaTopology schema name or NULL
[out]topogeomTopoGeometry column name or NULL
[out]topo_geo_onlyTRUE for Topo-Geo data model or NULL
Returns
GV_TOPO_NATIVE for native format
GV_TOPO_PSEUDO for pseudo-topology
GV_TOPO_POSTGIS for PostGIS Topology

Definition at line 248 of file header_finfo.c.

References _, Map_info::fInfo, Map_info::format, G_store(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, GV_TOPO_NATIVE, GV_TOPO_POSTGIS, GV_TOPO_PSEUDO, Format_info::pg, Format_info_pg::topo_geo_only, Format_info_pg::topogeom_column, and Format_info_pg::toposchema_name.