GRASS 8 Programmer's Manual 8.6.0dev(2026)-d2adb3a889
Loading...
Searching...
No Matches
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 charVect_get_finfo_dsn_name (struct Map_info *Map)
 Get datasource name (relevant only for non-native formats)
 
charVect_get_finfo_layer_name (struct Map_info *Map)
 Get layer name (relevant only for non-native formats)
 
const charVect_get_finfo_format_info (struct Map_info *Map)
 Get format info as string (relevant only for non-native formats)
 
const charVect_get_finfo_geometry_type (struct Map_info *Map)
 Get geometry type as string (relevant only for non-native formats)
 
const struct Format_infoVect_get_finfo (struct Map_info *Map)
 Get header info for non-native formats.
 
int Vect_get_finfo_topology_info (struct Map_info *Map, char **toposchema, char **topogeom, int *topo_geo_only)
 Get topology type (relevant only for non-native formats)
 

Detailed Description

Vector library - header manipulation (relevant for external formats)

Higher level functions for reading/writing/manipulating vectors.

SPDX-FileCopyrightText: 2001-2013 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later

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 ( 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 207 of file header_finfo.c.

References NULL.

◆ Vect_get_finfo_dsn_name()

const char * Vect_get_finfo_dsn_name ( 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 35 of file header_finfo.c.

References _, G_debug(), G_free(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, NULL, and Vect_get_full_name().

◆ Vect_get_finfo_format_info()

const char * Vect_get_finfo_format_info ( 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 102 of file header_finfo.c.

References GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, and NULL.

Referenced by Vect_build_ogr(), and Vect_build_pg().

◆ Vect_get_finfo_geometry_type()

const char * Vect_get_finfo_geometry_type ( 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 129 of file header_finfo.c.

References _, DB_SQL_MAX, 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, NULL, and Format_info_pg::res.

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

◆ Vect_get_finfo_layer_name()

char * Vect_get_finfo_layer_name ( 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 69 of file header_finfo.c.

References _, G_asprintf(), G_debug(), G_free(), G_store(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, name, NULL, and Vect_get_full_name().

Referenced by Vect_copy_map_lines_field().

◆ Vect_get_finfo_topology_info()

int Vect_get_finfo_topology_info ( 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 230 of file header_finfo.c.

References G_store(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, GV_TOPO_NATIVE, GV_TOPO_POSTGIS, GV_TOPO_PSEUDO, and Format_info_pg::topo_geo_only.