GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
Vector library - OGC Simple Features Access. More...
#include <stdio.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include "pg_local_proto.h"
#include <ogr_api.h>
Go to the source code of this file.
Functions | |
SF_FeatureType | Vect_sfa_get_line_type (const struct line_pnts *Points, int type, int with_z) |
Get SF type of given vector feature. More... | |
int | Vect_sfa_get_type (SF_FeatureType sftype) |
Get relevant GV type. More... | |
int | Vect_sfa_check_line_type (const struct line_pnts *Points, int type, SF_FeatureType sftype, int with_z) |
Check SF type. More... | |
int | Vect_sfa_line_dimension (int type) |
Get geometry dimension. More... | |
char * | Vect_sfa_line_geometry_type (const struct line_pnts *Points, int type) |
Get geometry type (string) More... | |
int | Vect_sfa_line_astext (const struct line_pnts *Points, int type, int with_z, int precision, FILE *file) |
Export geometry to Well-Known Text. More... | |
int | Vect_sfa_is_line_simple (const struct line_pnts *Points UNUSED, int type UNUSED, int with_z UNUSED) |
Check if feature is simple. More... | |
int | Vect_sfa_is_line_closed (const struct line_pnts *Points, int type, int with_z) |
Check if feature is closed. More... | |
int | Vect_sfa_get_num_features (struct Map_info *Map) |
Get number of simple features. More... | |
Vector library - OGC Simple Features Access.
Higher level functions for reading/writing/manipulating vectors.
Note: In progress! Currently on GV_POINT, GV_LINE, GV_BOUNDARY are supported.
Reference: http://www.opengeospatial.org/standards/sfa
(C) 2009, 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.
Definition in file simple_features.c.
int Vect_sfa_check_line_type | ( | const struct line_pnts * | Points, |
int | type, | ||
SF_FeatureType | sftype, | ||
int | with_z | ||
) |
Check SF type.
E.g. if type is GV_LINE with two or more segments and the start node is identical with the end node, and sftype is SF_LINEARRING, functions returns 1, otherwise 0.
Points | pointer to line_pnts structure |
type | feature type (GV_POINT, GV_LINE, ...) |
sftype | SF type to be checked (SF_POINT, SF_LINE, ...) |
with_z | non-zero value for 3D data |
Definition at line 114 of file simple_features.c.
SF_FeatureType Vect_sfa_get_line_type | ( | const struct line_pnts * | Points, |
int | type, | ||
int | with_z | ||
) |
Get SF type of given vector feature.
List of supported feature types:
Points | pointer to line_pnts structure |
type | feature type (see supported types above) |
with_z | WITH_Z for 3D data |
Definition at line 64 of file simple_features.c.
int Vect_sfa_get_num_features | ( | struct Map_info * | Map | ) |
Get number of simple features.
For native format or PostGIS Topology returns -1
Map | vector map |
Definition at line 300 of file simple_features.c.
References _, Format_info_pg::conn, DB_SQL_MAX, Map_info::fInfo, Map_info::format, G_fatal_error(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer, Format_info::ogr, Format_info::pg, Format_info_pg::schema_name, Format_info_pg::table_name, Format_info_pg::toposchema_name, TRUE, Vect__execute_get_value_pg(), and Vect_get_full_name().
int Vect_sfa_get_type | ( | SF_FeatureType | sftype | ) |
Get relevant GV type.
Map | pointer to Map_info structure |
type | SF geometry type (SF_POINT, SF_LINESTRING, ...) |
Definition at line 79 of file simple_features.c.
References GV_BOUNDARY, GV_LINE, GV_POINT, SF_LINEARRING, SF_LINESTRING, SF_LINESTRING25D, SF_POINT, SF_POINT25D, SF_POLYGON, and SF_POLYGON25D.
int Vect_sfa_is_line_closed | ( | const struct line_pnts * | Points, |
int | type, | ||
int | with_z | ||
) |
Check if feature is closed.
Points | pointer to line_pnts structure |
type | feature type (GV_LINE or GV_BOUNDARY) |
Definition at line 271 of file simple_features.c.
int Vect_sfa_is_line_simple | ( | const struct line_pnts *Points | UNUSED, |
int type | UNUSED, | ||
int with_z | UNUSED | ||
) |
Check if feature is simple.
Points | pointer to line_pnts structure |
type | feature type (GV_POINT, GV_LINE, ...) |
Definition at line 248 of file simple_features.c.
int Vect_sfa_line_astext | ( | const struct line_pnts * | Points, |
int | type, | ||
int | with_z, | ||
int | precision, | ||
FILE * | file | ||
) |
Export geometry to Well-Known Text.
Points | pointer to line_pnts structure | |
type | feature type | |
with_z | non-zero value for 3D data | |
precision | floating number precision | |
[out] | file | file where to write the output |
Definition at line 188 of file simple_features.c.
int Vect_sfa_line_dimension | ( | int | type | ) |
Get geometry dimension.
Points | pointer to line_pnts structure |
type | feature type (GV_POINT, GV_LINE, ...) |
Definition at line 131 of file simple_features.c.
char* Vect_sfa_line_geometry_type | ( | const struct line_pnts * | Points, |
int | type | ||
) |
Get geometry type (string)
Supported types:
Note: Allocated string should be freed by G_free().
Points | pointer to line_pnts structure (feature geometry) |
type | feature type (see supported types above) |
Definition at line 160 of file simple_features.c.