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

Vector library - GEOS support. More...

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

Go to the source code of this file.

Functions

GEOSGeometryVect_read_line_geos (struct Map_info *Map, int line, int *type)
 Read vector feature and stores it as GEOSGeometry instance. More...
 
GEOSGeometryVect_read_area_geos (struct Map_info *Map, int area)
 Read vector area and stores it as GEOSGeometry instance (polygon) More...
 
GEOSGeometryVect_line_to_geos (const struct line_pnts *points, int type, int with_z)
 Create GEOSGeometry of given type from feature points. More...
 
GEOSCoordSequenceVect_get_area_points_geos (struct Map_info *Map, int area)
 Returns the polygon array of points, i.e. outer ring (shell) More...
 
GEOSCoordSequenceVect_get_isle_points_geos (struct Map_info *Map, int isle)
 Returns the polygon (isle) array of points (inner ring) More...
 

Detailed Description

Vector library - GEOS support.

Higher level functions for reading/writing/manipulating vectors.

(C) 2009 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
Martin Landa <landa.martin gmail.com>

Definition in file geos.c.

Function Documentation

◆ Vect_get_area_points_geos()

GEOSCoordSequence* Vect_get_area_points_geos ( struct Map_info Map,
int  area 
)

Returns the polygon array of points, i.e. outer ring (shell)

You should free allocated memory by GEOSCoordSeq_destroy().

See also Vect_get_area_points().

Parameters
Mappointer to Map_info
areaarea id
Returns
pointer to GEOSCoordSequence
empty GEOSCoordSequence for dead area
NULL on error

Definition at line 401 of file geos.c.

References _, Plus_head::Area, G_debug(), G_warning(), NULL, and Map_info::plus.

◆ Vect_get_isle_points_geos()

GEOSCoordSequence* Vect_get_isle_points_geos ( struct Map_info Map,
int  isle 
)

Returns the polygon (isle) array of points (inner ring)

You should free allocated memory by GEOSCoordSeq_destroy().

See also Vect_get_isle_points().

Parameters
Mappointer to Map_info
isleisel id
Returns
pointer to GEOSGeometry
NULL on error or dead line

Definition at line 432 of file geos.c.

References G_debug(), Plus_head::Isle, and Map_info::plus.

◆ Vect_line_to_geos()

GEOSGeometry* Vect_line_to_geos ( const struct line_pnts points,
int  type,
int  with_z 
)

Create GEOSGeometry of given type from feature points.

Supported types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING

You should free allocated memory by GEOSGeom_destroy().

Parameters
pointspointer to line_pnts structure
typefeature type (see supported types)
with_zSet to 1 if the feature is 3d, 0 otherwise
Returns
pointer to GEOSGeometry instance
NULL on error

Definition at line 132 of file geos.c.

◆ Vect_read_area_geos()

GEOSGeometry* Vect_read_area_geos ( struct Map_info Map,
int  area 
)

Read vector area and stores it as GEOSGeometry instance (polygon)

You should free allocated memory by GEOSGeom_destroy().

Parameters
Mappointer to Map_info structure
areaarea id
Returns
pointer to GEOSGeometry instance
NULL on error

Definition at line 81 of file geos.c.

Referenced by Vect_read_area_to_wkb(), and Vect_read_area_to_wkt().

◆ Vect_read_line_geos()

GEOSGeometry* Vect_read_line_geos ( struct Map_info Map,
int  line,
int *  type 
)

Read vector feature and stores it as GEOSGeometry instance.

Supported feature types:

  • GV_POINT -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINESTRING / LINEARRING

You should free allocated memory by GEOSGeom_destroy().

Parameters
Mappointer to Map_info structure
linefeature id
[out]typefeature type or NULL
Returns
pointer to GEOSGeometry instance
empty GEOSGeometry for unsupported feature type
NULL on error

Definition at line 45 of file geos.c.