GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r73101
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
geos_to_wktb.c File Reference

Vector library - GEOS powered WKT and WKB export. More...

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

Go to the source code of this file.

Functions

unsigned char * Vect_read_area_to_wkb (struct Map_info *Map, int area, size_t *size)
 Read vector area and return it as Well Known Binary (WKB) unsigned char array. More...
 
char * Vect_read_area_to_wkt (struct Map_info *Map, int area)
 Read vector area and return it as Well Known Text (WKT) unsigned char array. More...
 
unsigned char * Vect_read_line_to_wkb (const struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c, int line, size_t *size, int *error)
 Read a Well Known Binary (WKB) representation of a given feature id. More...
 
unsigned char * Vect_line_to_wkb (const struct line_pnts *points, int type, int with_z, size_t *size)
 Create a Well Known Binary (WKB) representation of given feature type from points. More...
 
char * Vect_line_to_wkt (const struct line_pnts *points, int type, int with_z)
 Create a Well Known Text (WKT) representation of given feature type from points. More...
 

Detailed Description

Vector library - GEOS powered WKT and WKB export.

Higher level functions for reading/writing/manipulating vectors.

(C) 2015 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
Soeren Gebbert <soerengebbert googlemail.com>

Definition in file geos_to_wktb.c.

Function Documentation

unsigned char* Vect_line_to_wkb ( const struct line_pnts points,
int  type,
int  with_z,
size_t *  size 
)

Create a Well Known Binary (WKB) representation of given feature type from points.

This function is not thread safe, it uses static variables for speedup.

Supported feature types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING
Parameters
pointspointer to line_pnts structure
typefeature type (see supported types)
with_zSet to 1 if the feature is 3d, 0 otherwise
sizeThe size of the returned byte array
Returns
pointer to char array
NULL on error

Definition at line 201 of file geos_to_wktb.c.

References init(), NULL, and Vect_line_to_geos().

char* Vect_line_to_wkt ( const struct line_pnts points,
int  type,
int  with_z 
)

Create a Well Known Text (WKT) representation of given feature type from points.

This function is not thread safe, it uses static variables for speedup.

Supported types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING
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 char array
NULL on error

Definition at line 249 of file geos_to_wktb.c.

References init(), NULL, and Vect_line_to_geos().

unsigned char* Vect_read_area_to_wkb ( struct Map_info Map,
int  area,
size_t *  size 
)

Read vector area and return it as Well Known Binary (WKB) unsigned char array.

Parameters
Mappointer to Map_info structure
areaarea id
sizeThe size of the returned unsigned char array
Returns
pointer to unsigned char array
NULL on error

Definition at line 33 of file geos_to_wktb.c.

References init(), NULL, and Vect_read_area_geos().

char* Vect_read_area_to_wkt ( struct Map_info Map,
int  area 
)

Read vector area and return it as Well Known Text (WKT) unsigned char array.

Parameters
Mappointer to Map_info structure
areaarea id
sizeThe size of the returned unsigned char array
Returns
pointer to char array
NULL on error

Definition at line 72 of file geos_to_wktb.c.

References init(), NULL, and Vect_read_area_geos().

unsigned char* Vect_read_line_to_wkb ( const struct Map_info Map,
struct line_pnts line_p,
struct line_cats line_c,
int  line,
size_t *  size,
int error 
)

Read a Well Known Binary (WKB) representation of a given feature id.

This function reads a specific feature and converts it into a WKB representation. line_pnts and line_cats structures can be provided to store the result of the read operation. That is meaningful in case the category values of the feature are needed. This function is not thread safe, it uses static variables for speedup.

Supported feature types:

  • GV_POINT -> POINT
  • GV_CENTROID -> POINT
  • GV_LINE -> LINESTRING
  • GV_BOUNDARY -> LINEARRING
Parameters
Mappointer to Map_info structure
line_ppointer to line_pnts structure to use, or NULL
line_cpointer to line_cats structure to use, or NULL
lineThe id of the feature to read
sizeThe size of the returned unsigned char array
Returns
pointer to unsigned char array
NULL on error

Definition at line 125 of file geos_to_wktb.c.

References init(), NULL, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_is_3d(), Vect_line_to_geos(), Vect_new_cats_struct(), Vect_new_line_struct(), and Vect_read_line().