40 static GEOSWKBWriter *writer =
NULL;
41 unsigned char *wkb =
NULL;
45 writer = GEOSWKBWriter_create();
49 GEOSWKBWriter_setOutputDimension(writer, 2);
57 wkb = GEOSWKBWriter_write(writer, geom, size);
59 GEOSGeom_destroy(geom);
94 static GEOSWKTWriter *writer =
NULL;
99 writer = GEOSWKTWriter_create();
103 GEOSWKTWriter_setOutputDimension(writer, 2);
104 GEOSWKTWriter_setTrim(writer, trim);
112 wkt = GEOSWKTWriter_write(writer, geom);
115 GEOSGeom_destroy(geom);
149 size_t *size,
int *error)
154 static GEOSWKBWriter *writer =
NULL;
155 unsigned char *wkb =
NULL;
156 int destroy_line = 0, destroy_cats = 0;
160 writer = GEOSWKBWriter_create();
164 if (line_p ==
NULL) {
169 if (line_c ==
NULL) {
182 GEOSWKBWriter_setOutputDimension(writer,
Vect_is_3d(Map) ? 3 : 2);
186 if (destroy_cats == 1)
189 if (destroy_line == 1)
196 wkb = GEOSWKBWriter_write(writer, geom, size);
198 GEOSGeom_destroy(geom);
224 int with_z,
size_t *size)
229 static GEOSWKBWriter *writer =
NULL;
230 unsigned char *wkb =
NULL;
234 writer = GEOSWKBWriter_create();
238 GEOSWKBWriter_setOutputDimension(writer, with_z ? 3 : 2);
246 wkb = GEOSWKBWriter_write(writer, geom, size);
248 GEOSGeom_destroy(geom);
291 static GEOSWKTWriter *writer =
NULL;
296 writer = GEOSWKTWriter_create();
300 GEOSWKTWriter_setOutputDimension(writer, with_z ? 3 : 2);
301 GEOSWKTWriter_setTrim(writer, trim);
309 wkt = GEOSWKTWriter_write(writer, geom);
312 GEOSGeom_destroy(geom);
char * G_store(const char *)
Copy string to allocated memory.
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
GEOSGeometry * Vect_read_area_geos(struct Map_info *, int)
Read vector area and stores it as GEOSGeometry instance (polygon)
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
GEOSGeometry * Vect_line_to_geos(const struct line_pnts *, int, int)
Create GEOSGeometry of given type from feature points.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_is_3d(struct Map_info *)
Check if vector map is 3D.
unsigned char * Vect_read_line_to_wkb(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.
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.
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.
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.
char * Vect_read_area_to_wkt2(struct Map_info *Map, int area, bool trim)
Read vector area and return it as Well Known Text (WKT) unsigned char array.
char * Vect_line_to_wkt2(const struct line_pnts *points, int type, bool with_z, bool trim)
Create a Well Known Text (WKT) representation of given feature type from points.
char * Vect_line_to_wkt(const struct line_pnts *points, int type, bool with_z)
Create a Well Known Text (WKT) representation of given feature type from points.
Feature geometry info - coordinates.
struct GEOSGeom_t GEOSGeometry