PostGIS  3.2.2dev-r@@SVN_REVISION@@
liblwgeom.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright 2011 Sandro Santilli <strk@kbt.io>
22  * Copyright 2011 Paul Ramsey <pramsey@cleverelephant.ca>
23  * Copyright 2007-2008 Mark Cave-Ayland
24  * Copyright 2001-2006 Refractions Research Inc.
25  *
26  **********************************************************************/
27 
28 
29 #ifndef _LIBLWGEOM_H
30 #define _LIBLWGEOM_H 1
31 
32 #include <stdarg.h>
33 #include <stdint.h>
34 #include <stdio.h>
35 
36 #include "../postgis_config.h"
37 
38 #if POSTGIS_PROJ_VERSION < 61
39 
40 /* For Proj 6.0 use of old API */
41 #define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
42 
43 #include "proj_api.h"
44 typedef struct PJ
45 {
46  projPJ pj_from;
47  projPJ pj_to;
48 } PJ;
49 
50 typedef PJ LWPROJ;
51 
52 #else
53 #include "proj.h"
54 
55 /* For PROJ6 we cache several extra values to avoid calls to proj_get_source_crs
56  * or proj_get_target_crs since those are very costly
57  */
58 typedef struct LWPROJ
59 {
60  PJ* pj;
61  /* Source crs is geographic: Used in geography calls (source srid == dst srid) */
63  /* Source ellipsoid parameters */
67 #endif
68 
69 #if POSTGIS_PROJ_VERSION < 49
70 /* Use the old (pre-2.2) geodesic functions */
71 #undef PROJ_GEODESIC
72 #else
73 /* Enable new geodesic functions API */
74 #define PROJ_GEODESIC
75 #endif
76 
96 #define LIBLWGEOM_VERSION "3.2.9dev"
97 #define LIBLWGEOM_VERSION_MAJOR "3"
98 #define LIBLWGEOM_VERSION_MINOR "2"
99 #define LIBLWGEOM_GEOS_VERSION "30906"
100 
102 const char* lwgeom_version(void);
103 
107 #define LW_TRUE 1
108 #define LW_FALSE 0
109 #define LW_UNKNOWN 2
110 #define LW_FAILURE 0
111 #define LW_SUCCESS 1
112 
116 #define POINTTYPE 1
117 #define LINETYPE 2
118 #define POLYGONTYPE 3
119 #define MULTIPOINTTYPE 4
120 #define MULTILINETYPE 5
121 #define MULTIPOLYGONTYPE 6
122 #define COLLECTIONTYPE 7
123 #define CIRCSTRINGTYPE 8
124 #define COMPOUNDTYPE 9
125 #define CURVEPOLYTYPE 10
126 #define MULTICURVETYPE 11
127 #define MULTISURFACETYPE 12
128 #define POLYHEDRALSURFACETYPE 13
129 #define TRIANGLETYPE 14
130 #define TINTYPE 15
131 
132 #define NUMTYPES 16
133 
138 #define WKBZOFFSET 0x80000000
139 #define WKBMOFFSET 0x40000000
140 #define WKBSRIDFLAG 0x20000000
141 #define WKBBBOXFLAG 0x10000000
142 
144 typedef enum LWORD_T {
145  LWORD_X = 0,
146  LWORD_Y = 1,
147  LWORD_Z = 2,
148  LWORD_M = 3
150 
151 /**********************************************************************
152 ** Spherical radius.
153 ** Moritz, H. (1980). Geodetic Reference System 1980, by resolution of
154 ** the XVII General Assembly of the IUGG in Canberra.
155 ** http://en.wikipedia.org/wiki/Earth_radius
156 ** http://en.wikipedia.org/wiki/World_Geodetic_System
157 */
158 
159 #define WGS84_MAJOR_AXIS 6378137.0
160 #define WGS84_INVERSE_FLATTENING 298.257223563
161 #define WGS84_MINOR_AXIS (WGS84_MAJOR_AXIS - WGS84_MAJOR_AXIS / WGS84_INVERSE_FLATTENING)
162 #define WGS84_RADIUS ((2.0 * WGS84_MAJOR_AXIS + WGS84_MINOR_AXIS ) / 3.0)
163 #define WGS84_SRID 4326
164 
165 
172 #define LWFLAG_Z 0x01
173 #define LWFLAG_M 0x02
174 #define LWFLAG_BBOX 0x04
175 #define LWFLAG_GEODETIC 0x08
176 #define LWFLAG_READONLY 0x10
177 #define LWFLAG_SOLID 0x20
178 
179 #define FLAGS_GET_Z(flags) ((flags) & LWFLAG_Z)
180 #define FLAGS_GET_M(flags) (((flags) & LWFLAG_M)>>1)
181 #define FLAGS_GET_BBOX(flags) (((flags) & LWFLAG_BBOX)>>2)
182 #define FLAGS_GET_GEODETIC(flags) (((flags) & LWFLAG_GEODETIC)>>3)
183 #define FLAGS_GET_READONLY(flags) (((flags) & LWFLAG_READONLY)>>4)
184 #define FLAGS_GET_SOLID(flags) (((flags) & LWFLAG_SOLID)>>5)
185 
186 #define FLAGS_SET_Z(flags, value) ((flags) = (value) ? ((flags) | LWFLAG_Z) : ((flags) & ~LWFLAG_Z))
187 #define FLAGS_SET_M(flags, value) ((flags) = (value) ? ((flags) | LWFLAG_M) : ((flags) & ~LWFLAG_M))
188 #define FLAGS_SET_BBOX(flags, value) ((flags) = (value) ? ((flags) | LWFLAG_BBOX) : ((flags) & ~LWFLAG_BBOX))
189 #define FLAGS_SET_GEODETIC(flags, value) ((flags) = (value) ? ((flags) | LWFLAG_GEODETIC) : ((flags) & ~LWFLAG_GEODETIC))
190 #define FLAGS_SET_READONLY(flags, value) ((flags) = (value) ? ((flags) | LWFLAG_READONLY) : ((flags) & ~LWFLAG_READONLY))
191 #define FLAGS_SET_SOLID(flags, value) ((flags) = (value) ? ((flags) | LWFLAG_SOLID) : ((flags) & ~LWFLAG_SOLID))
192 
193 #define FLAGS_NDIMS(flags) (2 + FLAGS_GET_Z(flags) + FLAGS_GET_M(flags))
194 #define FLAGS_GET_ZM(flags) (FLAGS_GET_M(flags) + FLAGS_GET_Z(flags) * 2)
195 #define FLAGS_NDIMS_BOX(flags) (FLAGS_GET_GEODETIC(flags) ? 3 : FLAGS_NDIMS(flags))
196 
206 #define TYPMOD_GET_SRID(typmod) ((((typmod) & 0x0FFFFF00) - ((typmod) & 0x10000000)) >> 8)
207 #define TYPMOD_SET_SRID(typmod, srid) ((typmod) = (((typmod) & 0xE00000FF) | ((srid & 0x001FFFFF)<<8)))
208 #define TYPMOD_GET_TYPE(typmod) ((typmod & 0x000000FC)>>2)
209 #define TYPMOD_SET_TYPE(typmod, type) ((typmod) = (typmod & 0xFFFFFF03) | ((type & 0x0000003F)<<2))
210 #define TYPMOD_GET_Z(typmod) ((typmod & 0x00000002)>>1)
211 #define TYPMOD_SET_Z(typmod) ((typmod) = typmod | 0x00000002)
212 #define TYPMOD_GET_M(typmod) (typmod & 0x00000001)
213 #define TYPMOD_SET_M(typmod) ((typmod) = typmod | 0x00000001)
214 #define TYPMOD_GET_NDIMS(typmod) (2+TYPMOD_GET_Z(typmod)+TYPMOD_GET_M(typmod))
215 
220 #define SRID_MAXIMUM 999999
221 
226 #define SRID_USER_MAXIMUM 998999
227 
229 #define SRID_UNKNOWN 0
230 #define SRID_IS_UNKNOWN(x) ((int)x<=0)
231 
232 /* Invalid SRID value, for internal use */
233 #define SRID_INVALID (999999 + 2)
234 
235 /*
236 ** EPSG WGS84 geographics, OGC standard default SRS, better be in
237 ** the SPATIAL_REF_SYS table!
238 */
239 #define SRID_DEFAULT 4326
240 
241 #ifndef __GNUC__
242 # define __attribute__(x)
243 #endif
244 
251 extern int32_t clamp_srid(int32_t srid);
252 
256 typedef void* (*lwallocator)(size_t size);
257 typedef void* (*lwreallocator)(void *mem, size_t size);
258 typedef void (*lwfreeor)(void* mem);
259 typedef void (*lwreporter)(const char* fmt, va_list ap)
260  __attribute__ (( format(printf, 1, 0) ));
261 typedef void (*lwdebuglogger)(int level, const char* fmt, va_list ap)
262  __attribute__ (( format(printf, 2,0) ));
263 
270 extern void lwgeom_set_handlers(lwallocator allocator,
271  lwreallocator reallocator, lwfreeor freeor, lwreporter errorreporter,
272  lwreporter noticereporter);
273 
274 extern void lwgeom_set_debuglogger(lwdebuglogger debuglogger);
275 
288 extern void lwgeom_request_interrupt(void);
289 
293 extern void lwgeom_cancel_interrupt(void);
294 
305 typedef void (lwinterrupt_callback)();
307 
308 
309 /******************************************************************
310 * LWGEOM and GBOX both use LWFLAGS bit mask.
311 * Serializations (may) use different bit mask schemes.
312 */
313 typedef uint16_t lwflags_t;
314 
315 /******************************************************************
316 * LWGEOM varlena equivalent type that contains both the size and
317 * data(see Postgresql c.h)
318 */
319 typedef struct lwvarlena_t
320 {
321  uint32_t size; /* Do not touch this field directly! */
322  char data[]; /* Data content is here */
324 
325 #define LWVARHDRSZ ((int32_t) sizeof(int32_t))
326 
333 #ifdef WORDS_BIGENDIAN
334 #define LWSIZE_GET(varsize) ((varsize) & 0x3FFFFFFF)
335 #define LWSIZE_SET(varsize, len) ((varsize) = ((len) & 0x3FFFFFFF))
336 #define IS_BIG_ENDIAN 1
337 #else
338 #define LWSIZE_GET(varsize) (((varsize) >> 2) & 0x3FFFFFFF)
339 #define LWSIZE_SET(varsize, len) ((varsize) = (((uint32_t)(len)) << 2))
340 #define IS_BIG_ENDIAN 0
341 #endif
342 
343 /******************************************************************/
344 
345 typedef struct {
346  double afac, bfac, cfac, dfac, efac, ffac, gfac, hfac, ifac, xoff, yoff, zoff;
347 } AFFINE;
348 
349 /******************************************************************/
350 
351 typedef struct
352 {
353  double xmin, ymin, zmin;
354  double xmax, ymax, zmax;
355  int32_t srid;
356 }
357 BOX3D;
358 
359 /******************************************************************
360 * GBOX structure.
361 * We include the flags (information about dimensionality),
362 * so we don't have to constantly pass them
363 * into functions that use the GBOX.
364 */
365 typedef struct
366 {
368  double xmin;
369  double xmax;
370  double ymin;
371  double ymax;
372  double zmin;
373  double zmax;
374  double mmin;
375  double mmax;
376 } GBOX;
377 
378 
379 /******************************************************************
380 * SPHEROID
381 *
382 * Standard definition of an ellipsoid (what wkt calls a spheroid)
383 * f = (a-b)/a
384 * e_sq = (a*a - b*b)/(a*a)
385 * b = a - fa
386 */
387 typedef struct
388 {
389  double a; /* semimajor axis */
390  double b; /* semiminor axis b = (a - fa) */
391  double f; /* flattening f = (a-b)/a */
392  double e; /* eccentricity (first) */
393  double e_sq; /* eccentricity squared (first) e_sq = (a*a-b*b)/(a*a) */
394  double radius; /* spherical average radius = (2*a+b)/3 */
395  char name[20]; /* name of ellipse */
396 }
397 SPHEROID;
398 
399 /******************************************************************
400 * POINT2D, POINT3D, POINT3DM, POINT4D
401 */
402 typedef struct
403 {
404  double x, y;
405 }
406 POINT2D;
407 
408 typedef struct
409 {
410  double x, y, z;
411 }
412 POINT3DZ;
413 
414 typedef struct
415 {
416  double x, y, z;
417 }
418 POINT3D;
419 
420 typedef struct
421 {
422  double x, y, m;
423 }
424 POINT3DM;
425 
426 typedef struct
427 {
428  double x, y, z, m;
429 }
430 POINT4D;
431 
432 /******************************************************************
433 * POINTARRAY
434 * Point array abstracts a lot of the complexity of points and point lists.
435 * It handles 2d/3d translation
436 * (2d points converted to 3d will have z=0 or NaN)
437 * DO NOT MIX 2D and 3D POINTS! EVERYTHING* is either one or the other
438 */
439 typedef struct
440 {
441  uint32_t npoints; /* how many points we are currently storing */
442  uint32_t maxpoints; /* how many points we have space for in serialized_pointlist */
443 
444  /* Use FLAGS_* macros to handle */
446 
447  /* Array of POINT 2D, 3D or 4D, possibly misaligned. */
449 }
450 POINTARRAY;
451 
452 /******************************************************************
453 * GSERIALIZED
454 */
455 
456 typedef struct
457 {
458  uint32_t size; /* For PgSQL use only, use VAR* macros to manipulate. */
459  uint8_t srid[3]; /* 24 bits of SRID */
460  uint8_t gflags; /* HasZ, HasM, HasBBox, IsGeodetic */
461  uint8_t data[1]; /* See gserialized.txt */
462 } GSERIALIZED;
463 
464 /******************************************************************
465 * LWGEOM (any geometry type)
466 *
467 * Abstract type, note that 'type', 'bbox' and 'srid' are available in
468 * all geometry variants.
469 */
470 typedef struct
471 {
473  void *data;
474  int32_t srid;
476  uint8_t type;
477  char pad[1]; /* Padding to 24 bytes (unused) */
478 }
479 LWGEOM;
480 
481 /* POINTYPE */
482 typedef struct
483 {
485  POINTARRAY *point; /* hide 2d/3d (this will be an array of 1 point) */
486  int32_t srid;
488  uint8_t type; /* POINTTYPE */
489  char pad[1]; /* Padding to 24 bytes (unused) */
490 }
491 LWPOINT; /* "light-weight point" */
492 
493 /* LINETYPE */
494 typedef struct
495 {
497  POINTARRAY *points; /* array of POINT3D */
498  int32_t srid;
500  uint8_t type; /* LINETYPE */
501  char pad[1]; /* Padding to 24 bytes (unused) */
502 }
503 LWLINE; /* "light-weight line" */
504 
505 /* TRIANGLE */
506 typedef struct
507 {
510  int32_t srid;
512  uint8_t type;
513  char pad[1]; /* Padding to 24 bytes (unused) */
514 }
515 LWTRIANGLE;
516 
517 /* CIRCSTRINGTYPE */
518 typedef struct
519 {
521  POINTARRAY *points; /* array of POINT(3D/3DM) */
522  int32_t srid;
524  uint8_t type; /* CIRCSTRINGTYPE */
525  char pad[1]; /* Padding to 24 bytes (unused) */
526 }
527 LWCIRCSTRING; /* "light-weight circularstring" */
528 
529 /* POLYGONTYPE */
530 typedef struct
531 {
533  POINTARRAY **rings; /* list of rings (list of points) */
534  int32_t srid;
536  uint8_t type; /* POLYGONTYPE */
537  char pad[1]; /* Padding to 24 bytes (unused) */
538  uint32_t nrings; /* how many rings we are currently storing */
539  uint32_t maxrings; /* how many rings we have space for in **rings */
540 }
541 LWPOLY; /* "light-weight polygon" */
542 
543 /* MULTIPOINTTYPE */
544 typedef struct
545 {
548  int32_t srid;
550  uint8_t type; /* MULTYPOINTTYPE */
551  char pad[1]; /* Padding to 24 bytes (unused) */
552  uint32_t ngeoms; /* how many geometries we are currently storing */
553  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
554 }
555 LWMPOINT;
556 
557 /* MULTILINETYPE */
558 typedef struct
559 {
562  int32_t srid;
564  uint8_t type; /* MULTILINETYPE */
565  char pad[1]; /* Padding to 24 bytes (unused) */
566  uint32_t ngeoms; /* how many geometries we are currently storing */
567  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
568 }
569 LWMLINE;
570 
571 /* MULTIPOLYGONTYPE */
572 typedef struct
573 {
576  int32_t srid;
578  uint8_t type; /* MULTIPOLYGONTYPE */
579  char pad[1]; /* Padding to 24 bytes (unused) */
580  uint32_t ngeoms; /* how many geometries we are currently storing */
581  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
582 }
583 LWMPOLY;
584 
585 /* COLLECTIONTYPE */
586 typedef struct
587 {
590  int32_t srid;
592  uint8_t type; /* COLLECTIONTYPE */
593  char pad[1]; /* Padding to 24 bytes (unused) */
594  uint32_t ngeoms; /* how many geometries we are currently storing */
595  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
596 }
598 
599 /* COMPOUNDTYPE */
600 typedef struct
601 {
604  int32_t srid;
606  uint8_t type; /* COLLECTIONTYPE */
607  char pad[1]; /* Padding to 24 bytes (unused) */
608  uint32_t ngeoms; /* how many geometries we are currently storing */
609  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
610 }
611 LWCOMPOUND; /* "light-weight compound line" */
612 
613 /* CURVEPOLYTYPE */
614 typedef struct
615 {
618  int32_t srid;
620  uint8_t type; /* CURVEPOLYTYPE */
621  char pad[1]; /* Padding to 24 bytes (unused) */
622  uint32_t nrings; /* how many rings we are currently storing */
623  uint32_t maxrings; /* how many rings we have space for in **rings */
624 }
625 LWCURVEPOLY; /* "light-weight polygon" */
626 
627 /* MULTICURVE */
628 typedef struct
629 {
632  int32_t srid;
634  uint8_t type; /* MULTICURVE */
635  char pad[1]; /* Padding to 24 bytes (unused) */
636  uint32_t ngeoms; /* how many geometries we are currently storing */
637  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
638 }
639 LWMCURVE;
640 
641 /* MULTISURFACETYPE */
642 typedef struct
643 {
646  int32_t srid;
648  uint8_t type; /* MULTISURFACETYPE */
649  char pad[1]; /* Padding to 24 bytes (unused) */
650  uint32_t ngeoms; /* how many geometries we are currently storing */
651  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
652 }
653 LWMSURFACE;
654 
655 /* POLYHEDRALSURFACETYPE */
656 typedef struct
657 {
660  int32_t srid;
662  uint8_t type; /* POLYHEDRALSURFACETYPE */
663  char pad[1]; /* Padding to 24 bytes (unused) */
664  uint32_t ngeoms; /* how many geometries we are currently storing */
665  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
666 }
667 LWPSURFACE;
668 
669 /* TINTYPE */
670 typedef struct
671 {
674  int32_t srid;
676  uint8_t type; /* TINTYPE */
677  char pad[1]; /* Padding to 24 bytes (unused) */
678  uint32_t ngeoms; /* how many geometries we are currently storing */
679  uint32_t maxgeoms; /* how many geometries we have space for in **geoms */
680 }
681 LWTIN;
682 
683 /* Casts LWGEOM->LW* (return NULL if cast is illegal) */
684 extern LWMPOLY *lwgeom_as_lwmpoly(const LWGEOM *lwgeom);
685 extern LWMLINE *lwgeom_as_lwmline(const LWGEOM *lwgeom);
686 extern LWMPOINT *lwgeom_as_lwmpoint(const LWGEOM *lwgeom);
687 extern LWCOLLECTION *lwgeom_as_lwcollection(const LWGEOM *lwgeom);
688 extern LWPOLY *lwgeom_as_lwpoly(const LWGEOM *lwgeom);
689 extern LWLINE *lwgeom_as_lwline(const LWGEOM *lwgeom);
690 
691 extern LWCIRCSTRING *lwgeom_as_lwcircstring(const LWGEOM *lwgeom);
692 extern LWCURVEPOLY *lwgeom_as_lwcurvepoly(const LWGEOM *lwgeom);
693 extern LWCOMPOUND *lwgeom_as_lwcompound(const LWGEOM *lwgeom);
694 extern LWPSURFACE *lwgeom_as_lwpsurface(const LWGEOM *lwgeom);
695 extern LWTRIANGLE *lwgeom_as_lwtriangle(const LWGEOM *lwgeom);
696 extern LWTIN *lwgeom_as_lwtin(const LWGEOM *lwgeom);
697 extern LWGEOM *lwgeom_as_multi(const LWGEOM *lwgeom);
698 extern LWGEOM *lwgeom_as_curve(const LWGEOM *lwgeom);
699 
700 /* Casts LW*->LWGEOM (always cast) */
701 extern LWGEOM *lwtin_as_lwgeom(const LWTIN *obj);
702 extern LWGEOM *lwtriangle_as_lwgeom(const LWTRIANGLE *obj);
703 extern LWGEOM *lwpsurface_as_lwgeom(const LWPSURFACE *obj);
704 extern LWGEOM *lwmpoly_as_lwgeom(const LWMPOLY *obj);
705 extern LWGEOM *lwmline_as_lwgeom(const LWMLINE *obj);
706 extern LWGEOM *lwmpoint_as_lwgeom(const LWMPOINT *obj);
707 extern LWGEOM *lwcollection_as_lwgeom(const LWCOLLECTION *obj);
708 extern LWGEOM *lwcircstring_as_lwgeom(const LWCIRCSTRING *obj);
709 extern LWGEOM *lwcompound_as_lwgeom(const LWCOMPOUND *obj);
710 extern LWGEOM *lwcurvepoly_as_lwgeom(const LWCURVEPOLY *obj);
711 extern LWGEOM *lwpoly_as_lwgeom(const LWPOLY *obj);
712 extern LWGEOM *lwline_as_lwgeom(const LWLINE *obj);
713 extern LWGEOM *lwpoint_as_lwgeom(const LWPOINT *obj);
714 
715 
716 extern LWCOLLECTION* lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom);
717 extern LWMPOINT* lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj);
718 extern LWMLINE* lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj);
719 extern LWMPOLY* lwmpoly_add_lwpoly(LWMPOLY *mobj, const LWPOLY *obj);
720 extern LWPSURFACE* lwpsurface_add_lwpoly(LWPSURFACE *mobj, const LWPOLY *obj);
721 extern LWTIN* lwtin_add_lwtriangle(LWTIN *mobj, const LWTRIANGLE *obj);
722 
724 
728 extern lwflags_t lwflags(int hasz, int hasm, int geodetic);
729 
730 
731 
732 /***********************************************************************
733 ** GSERIALIZED API
734 */
735 
740 
745 extern const float * gserialized_get_float_box_p(const GSERIALIZED *g, size_t *ndims);
746 
751 extern uint32_t gserialized_get_type(const GSERIALIZED *g);
752 
757 extern uint32_t gserialized_max_header_size(void);
758 
764 extern int32_t gserialized_hash(const GSERIALIZED *g);
765 
770 extern int32_t gserialized_get_srid(const GSERIALIZED *g);
771 
776 extern void gserialized_set_srid(GSERIALIZED *g, int32_t srid);
777 
784 extern int gserialized_is_empty(const GSERIALIZED *g);
785 
789 extern int gserialized_has_bbox(const GSERIALIZED *gser);
790 
794 extern int gserialized_has_z(const GSERIALIZED *gser);
795 
799 extern int gserialized_has_m(const GSERIALIZED *gser);
800 
804 extern int gserialized_is_geodetic(const GSERIALIZED *gser);
805 
809 extern int gserialized_ndims(const GSERIALIZED *gser);
810 
820 extern int gserialized_cmp(const GSERIALIZED *g1, const GSERIALIZED *g2);
821 
829 extern GSERIALIZED* gserialized_from_lwgeom(LWGEOM *geom, size_t *size);
830 
835 extern LWGEOM* lwgeom_from_gserialized(const GSERIALIZED *g);
836 
842 extern int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box);
843 
848 extern int gserialized_fast_gbox_p(const GSERIALIZED *g, GBOX *box);
849 
856 
862 
866 extern uint32_t gserialized_get_version(const GSERIALIZED *g);
867 
871 extern int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point);
872 
873 /*****************************************************************************/
874 
875 
882 extern void lwgeom_drop_bbox(LWGEOM *lwgeom);
883 extern void lwgeom_drop_srid(LWGEOM *lwgeom);
884 
891 extern void lwgeom_add_bbox(LWGEOM *lwgeom);
895 extern void lwgeom_refresh_bbox(LWGEOM *lwgeom);
899 extern void lwgeom_add_bbox_deep(LWGEOM *lwgeom, GBOX *gbox);
900 
908 extern const GBOX *lwgeom_get_bbox(const LWGEOM *lwgeom);
909 
913 extern int lwgeom_is_collection(const LWGEOM *lwgeom);
914 
918 extern int lwgeom_isfinite(const LWGEOM *lwgeom);
919 
920 
921 /******************************************************************/
922 /* Functions that work on type numbers */
923 
927 extern int lwtype_is_collection(uint8_t type);
928 
932 extern uint32_t lwtype_get_collectiontype(uint8_t type);
933 
938 extern const char *lwtype_name(uint8_t type);
939 extern uint8_t lwtype_multitype(uint8_t type);
940 
941 /******************************************************************/
942 
943 /*
944  * copies a point from the point array into the parameter point
945  * will set point's z=0 (or NaN) if pa is 2d
946  * will set point's m=0 (or NaN) if pa is 3d or 2d
947  * NOTE: point is a real POINT3D *not* a pointer
948  */
949 extern POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n);
950 
951 /*
952  * copies a point from the point array into the parameter point
953  * will set point's z=0 (or NaN) if pa is 2d
954  * will set point's m=0 (or NaN) if pa is 3d or 2d
955  * NOTE: this will modify the point4d pointed to by 'point'.
956  */
957 extern int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point);
958 
959 /*
960  * copies a point from the point array into the parameter point
961  * will set point's z=0 (or NaN) if pa is 2d
962  * NOTE: point is a real POINT3D *not* a pointer
963  */
964 extern POINT3DZ getPoint3dz(const POINTARRAY *pa, uint32_t n);
965 extern POINT3DM getPoint3dm(const POINTARRAY *pa, uint32_t n);
966 
967 /*
968  * copies a point from the point array into the parameter point
969  * will set point's z=0 (or NaN) if pa is 2d
970  * NOTE: this will modify the point3d pointed to by 'point'.
971  */
972 extern int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *point);
973 extern int getPoint3dm_p(const POINTARRAY *pa, uint32_t n, POINT3DM *point);
974 
975 
976 /*
977  * copies a point from the point array into the parameter point
978  * z value (if present is not returned)
979  * NOTE: point is a real POINT3D *not* a pointer
980  */
981 extern POINT2D getPoint2d(const POINTARRAY *pa, uint32_t n);
982 
983 /*
984  * copies a point from the point array into the parameter point
985  * z value (if present is not returned)
986  * NOTE: this will modify the point2d pointed to by 'point'.
987  */
988 extern int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point);
989 
990 /*
991  * set point N to the given value
992  * NOTE that the pointarray can be of any
993  * dimension, the appropriate ordinate values
994  * will be extracted from it
995  *
996  * N must be a valid point index
997  */
998 extern void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d);
999 
1005 extern POINTARRAY* ptarray_construct(char hasz, char hasm, uint32_t npoints);
1006 
1010 extern POINTARRAY* ptarray_construct_copy_data(char hasz, char hasm, uint32_t npoints, const uint8_t *ptlist);
1011 
1015 extern POINTARRAY* ptarray_construct_reference_data(char hasz, char hasm, uint32_t npoints, uint8_t *ptlist);
1016 
1022 extern POINTARRAY* ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints);
1023 
1029 extern int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates);
1030 
1042 extern int ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance);
1043 
1048 extern int ptarray_insert_point(POINTARRAY *pa, const POINT4D *p, uint32_t where);
1049 
1054 extern int ptarray_remove_point(POINTARRAY *pa, uint32_t where);
1055 
1067 extern POINTARRAY *ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where);
1068 
1074 extern POINTARRAY *ptarray_removePoint(POINTARRAY *pa, uint32_t where);
1075 
1082 extern POINTARRAY *ptarray_merge(POINTARRAY *pa1, POINTARRAY *pa2);
1083 
1084 extern int ptarray_is_closed(const POINTARRAY *pa);
1085 extern int ptarray_is_closed_2d(const POINTARRAY *pa);
1086 extern int ptarray_is_closed_3d(const POINTARRAY *pa);
1087 extern int ptarray_is_closed_z(const POINTARRAY *pa);
1089 
1095 extern POINTARRAY *ptarray_substring(POINTARRAY *pa, double d1, double d2,
1096  double tolerance);
1097 
1103 extern int ptarray_closest_vertex_2d(const POINTARRAY *pa,
1104  const POINT2D *qp, double *dist);
1105 
1113 extern int ptarray_closest_segment_2d(const POINTARRAY *pa,
1114  const POINT2D *qp, double *dist);
1115 
1116 
1117 
1121 extern LWGEOM* lwgeom_force_2d(const LWGEOM *geom);
1122 extern LWGEOM* lwgeom_force_3dz(const LWGEOM *geom, double zval);
1123 extern LWGEOM* lwgeom_force_3dm(const LWGEOM *geom, double mval);
1124 extern LWGEOM* lwgeom_force_4d(const LWGEOM *geom, double zval, double mval);
1125 
1126 extern LWGEOM* lwgeom_set_effective_area(const LWGEOM *igeom, int set_area, double area);
1127 extern LWGEOM* lwgeom_chaikin(const LWGEOM *igeom, int n_iterations, int preserve_endpoint);
1128 extern LWGEOM* lwgeom_filter_m(LWGEOM *geom, double min, double max, int returnm);
1129 
1130 /*
1131  * Force to use SFS 1.1 geometry type
1132  * (rather than SFS 1.2 and/or SQL/MM)
1133  */
1134 extern LWGEOM* lwgeom_force_sfs(LWGEOM *geom, int version);
1135 
1136 
1137 /*--------------------------------------------------------
1138  * all the base types (point/line/polygon) will have a
1139  * basic constructor, basic de-serializer, basic serializer,
1140  * bounding box finder and (TODO) serialized form size finder.
1141  *--------------------------------------------------------*/
1142 
1143 /*
1144  * convenience functions to hide the POINTARRAY
1145  */
1146 extern int lwpoint_getPoint2d_p(const LWPOINT *point, POINT2D *out);
1147 extern int lwpoint_getPoint3dz_p(const LWPOINT *point, POINT3DZ *out);
1148 extern int lwpoint_getPoint3dm_p(const LWPOINT *point, POINT3DM *out);
1149 extern int lwpoint_getPoint4d_p(const LWPOINT *point, POINT4D *out);
1150 
1151 /******************************************************************
1152  * LWLINE functions
1153  ******************************************************************/
1154 
1158 extern int lwline_add_lwpoint(LWLINE *line, LWPOINT *point, uint32_t where);
1159 
1163 extern POINTARRAY* lwline_interpolate_points(const LWLINE *line, double length_fraction, char repeat);
1164 
1168 extern LWPOINT* lwline_interpolate_point_3d(const LWLINE *line, double distance);
1169 
1170 /******************************************************************
1171  * LWPOLY functions
1172  ******************************************************************/
1173 
1178 extern int lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa);
1179 
1184 extern int lwcurvepoly_add_ring(LWCURVEPOLY *poly, LWGEOM *ring);
1185 
1190 extern int lwcompound_add_lwgeom(LWCOMPOUND *comp, LWGEOM *geom);
1191 
1196 extern LWCOMPOUND* lwcompound_construct_from_lwline(const LWLINE *lwpoly);
1197 
1203 
1204 
1205 /******************************************************************
1206  * LWGEOM functions
1207  ******************************************************************/
1208 
1209 extern int lwcollection_ngeoms(const LWCOLLECTION *col);
1210 
1211 /* Given a generic geometry/collection, return the "simplest" form.
1212  * The elements of the homogenized collection are deeply cloned
1213  * */
1214 extern LWGEOM *lwgeom_homogenize(const LWGEOM *geom);
1215 
1216 
1217 /******************************************************************
1218  * LWMULTIx and LWCOLLECTION functions
1219  ******************************************************************/
1220 
1222 LWCOLLECTION* lwcollection_extract(const LWCOLLECTION *col, uint32_t type);
1223 
1224 
1225 /******************************************************************
1226  * SERIALIZED FORM functions
1227  ******************************************************************/
1228 
1234 extern void lwgeom_set_srid(LWGEOM *geom, int32_t srid);
1235 
1236 /*------------------------------------------------------
1237  * other stuff
1238  *
1239  * handle the double-to-float conversion. The results of this
1240  * will usually be a slightly bigger box because of the difference
1241  * between float8 and float4 representations.
1242  */
1243 
1244 extern BOX3D* box3d_from_gbox(const GBOX *gbox);
1245 extern GBOX* box3d_to_gbox(const BOX3D *b3d);
1246 
1247 void expand_box3d(BOX3D *box, double d);
1248 
1249 
1250 /****************************************************************
1251  * MEMORY MANAGEMENT
1252  ****************************************************************/
1253 
1254 /*
1255 * The *_free family of functions frees *all* memory associated
1256 * with the pointer. When the recursion gets to the level of the
1257 * POINTARRAY, the POINTARRAY is only freed if it is not flagged
1258 * as "read only". LWGEOMs constructed on top of GSERIALIZED
1259 * from PgSQL use read only point arrays.
1260 */
1261 
1262 extern void ptarray_free(POINTARRAY *pa);
1263 extern void lwpoint_free(LWPOINT *pt);
1264 extern void lwline_free(LWLINE *line);
1265 extern void lwpoly_free(LWPOLY *poly);
1266 extern void lwtriangle_free(LWTRIANGLE *triangle);
1267 extern void lwmpoint_free(LWMPOINT *mpt);
1268 extern void lwmline_free(LWMLINE *mline);
1269 extern void lwmpoly_free(LWMPOLY *mpoly);
1270 extern void lwpsurface_free(LWPSURFACE *psurf);
1271 extern void lwtin_free(LWTIN *tin);
1272 extern void lwcollection_free(LWCOLLECTION *col);
1273 extern void lwcircstring_free(LWCIRCSTRING *curve);
1274 extern void lwgeom_free(LWGEOM *geom);
1275 
1276 /*
1277 * The *_release family of functions frees the LWGEOM structures
1278 * surrounding the POINTARRAYs but leaves the POINTARRAYs
1279 * intact. Useful when re-shaping geometries between types,
1280 * or splicing geometries together.
1281 */
1282 
1283 extern void lwpoint_release(LWPOINT *lwpoint);
1284 extern void lwline_release(LWLINE *lwline);
1285 extern void lwpoly_release(LWPOLY *lwpoly);
1286 extern void lwtriangle_release(LWTRIANGLE *lwtriangle);
1287 extern void lwcircstring_release(LWCIRCSTRING *lwcirc);
1288 extern void lwmpoint_release(LWMPOINT *lwpoint);
1289 extern void lwmline_release(LWMLINE *lwline);
1290 extern void lwmpoly_release(LWMPOLY *lwpoly);
1291 extern void lwpsurface_release(LWPSURFACE *lwpsurface);
1292 extern void lwtin_release(LWTIN *lwtin);
1293 extern void lwcollection_release(LWCOLLECTION *lwcollection);
1294 extern void lwgeom_release(LWGEOM *lwgeom);
1295 
1296 
1297 /****************************************************************
1298 * Utility
1299 ****************************************************************/
1300 
1301 extern void printBOX3D(BOX3D *b);
1302 extern void printPA(POINTARRAY *pa);
1303 extern void printLWPOINT(LWPOINT *point);
1304 extern void printLWLINE(LWLINE *line);
1305 extern void printLWPOLY(LWPOLY *poly);
1306 extern void printLWTRIANGLE(LWTRIANGLE *triangle);
1307 extern void printLWPSURFACE(LWPSURFACE *psurf);
1308 extern void printLWTIN(LWTIN *tin);
1309 
1310 extern float next_float_down(double d);
1311 extern float next_float_up(double d);
1312 
1313 /* general utilities 2D */
1314 extern double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2);
1315 extern double distance2d_sqr_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B);
1316 extern LWGEOM* lwgeom_closest_line(const LWGEOM *lw1, const LWGEOM *lw2);
1317 extern LWGEOM* lwgeom_furthest_line(const LWGEOM *lw1, const LWGEOM *lw2);
1318 extern LWGEOM* lwgeom_closest_point(const LWGEOM *lw1, const LWGEOM *lw2);
1319 extern LWGEOM* lwgeom_furthest_point(const LWGEOM *lw1, const LWGEOM *lw2);
1320 extern double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2);
1321 extern double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance);
1322 extern double lwgeom_maxdistance2d(const LWGEOM *lw1, const LWGEOM *lw2);
1323 extern double lwgeom_maxdistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance);
1324 
1325 /* 3D */
1326 extern double distance3d_pt_pt(const POINT3D *p1, const POINT3D *p2);
1327 extern double distance3d_pt_seg(const POINT3D *p, const POINT3D *A, const POINT3D *B);
1328 
1329 extern LWGEOM* lwgeom_furthest_line_3d(LWGEOM *lw1, LWGEOM *lw2);
1330 extern LWGEOM* lwgeom_closest_line_3d(const LWGEOM *lw1, const LWGEOM *lw2);
1331 extern LWGEOM* lwgeom_closest_point_3d(const LWGEOM *lw1, const LWGEOM *lw2);
1332 
1333 
1334 extern double lwgeom_mindistance3d(const LWGEOM *lw1, const LWGEOM *lw2);
1335 extern double lwgeom_mindistance3d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance);
1336 extern double lwgeom_maxdistance3d(const LWGEOM *lw1, const LWGEOM *lw2);
1337 extern double lwgeom_maxdistance3d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance);
1338 
1339 extern double lwgeom_area(const LWGEOM *geom);
1340 extern double lwgeom_length(const LWGEOM *geom);
1341 extern double lwgeom_length_2d(const LWGEOM *geom);
1342 extern double lwgeom_perimeter(const LWGEOM *geom);
1343 extern double lwgeom_perimeter_2d(const LWGEOM *geom);
1344 extern int lwgeom_dimension(const LWGEOM *geom);
1345 
1346 extern LWPOINT* lwline_get_lwpoint(const LWLINE *line, uint32_t where);
1347 extern LWPOINT* lwcircstring_get_lwpoint(const LWCIRCSTRING *circ, uint32_t where);
1348 
1349 extern LWPOINT* lwcompound_get_startpoint(const LWCOMPOUND *lwcmp);
1350 extern LWPOINT* lwcompound_get_endpoint(const LWCOMPOUND *lwcmp);
1351 extern LWPOINT* lwcompound_get_lwpoint(const LWCOMPOUND *lwcmp, uint32_t where);
1352 
1353 extern double ptarray_length_2d(const POINTARRAY *pts);
1354 extern int pt_in_ring_2d(const POINT2D *p, const POINTARRAY *ring);
1355 extern int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret);
1356 extern int lwpoint_inside_circle(const LWPOINT *p, double cx, double cy, double rad);
1357 
1358 extern LWGEOM* lwgeom_reverse(const LWGEOM *lwgeom);
1359 extern char* lwgeom_summary(const LWGEOM *lwgeom, int offset);
1360 extern char* lwpoint_to_latlon(const LWPOINT *p, const char *format);
1361 extern int lwgeom_startpoint(const LWGEOM* lwgeom, POINT4D* pt);
1362 
1363 extern void interpolate_point4d(const POINT4D *A, const POINT4D *B, POINT4D *I, double F);
1364 
1369 extern int lwgeom_is_clockwise(LWGEOM *lwgeom);
1370 
1371 
1375 extern LWGEOM* lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed);
1376 extern LWGEOM* lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance);
1377 
1381 typedef struct gridspec_t
1382 {
1383  double ipx;
1384  double ipy;
1385  double ipz;
1386  double ipm;
1387  double xsize;
1388  double ysize;
1389  double zsize;
1390  double msize;
1391 }
1393 
1394 extern LWGEOM* lwgeom_grid(const LWGEOM *lwgeom, const gridspec *grid);
1395 extern void lwgeom_grid_in_place(LWGEOM *lwgeom, const gridspec *grid);
1396 
1397 
1398 /****************************************************************
1399 * READ/WRITE FUNCTIONS
1400 *
1401 * Coordinate writing functions, which will alter the coordinates
1402 * and potentially the structure of the input geometry. When
1403 * called from within PostGIS, the LWGEOM argument should be built
1404 * on top of a gserialized copy, created using
1405 * PG_GETARG_GSERIALIZED_P_COPY()
1406 ****************************************************************/
1407 
1408 extern void lwgeom_reverse_in_place(LWGEOM *lwgeom);
1409 extern void lwgeom_force_clockwise(LWGEOM *lwgeom);
1410 extern void lwgeom_longitude_shift(LWGEOM *lwgeom);
1411 extern int lwgeom_simplify_in_place(LWGEOM *igeom, double dist, int preserve_collapsed);
1412 extern void lwgeom_affine(LWGEOM *geom, const AFFINE *affine);
1413 extern void lwgeom_scale(LWGEOM *geom, const POINT4D *factors);
1414 extern int lwgeom_remove_repeated_points_in_place(LWGEOM *in, double tolerance);
1415 
1416 
1429 LWGEOM *lwgeom_wrapx(const LWGEOM *lwgeom, double cutx, double amount);
1430 
1431 
1441 extern int lwgeom_needs_bbox(const LWGEOM *geom);
1442 
1446 extern uint32_t lwgeom_count_vertices(const LWGEOM *geom);
1447 
1452 extern uint32_t lwgeom_count_rings(const LWGEOM *geom);
1453 
1458 extern int lwgeom_has_srid(const LWGEOM *geom);
1459 
1464 extern int lwgeom_is_closed(const LWGEOM *geom);
1465 
1469 extern int lwgeom_dimensionality(const LWGEOM *geom);
1470 
1471 /* Is lwgeom1 geometrically equal to lwgeom2 ? */
1472 extern char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2);
1473 
1474 
1482 extern LWGEOM *lwgeom_clone(const LWGEOM *lwgeom);
1483 
1487 extern LWGEOM *lwgeom_clone_deep(const LWGEOM *lwgeom);
1488 extern POINTARRAY *ptarray_clone_deep(const POINTARRAY *ptarray);
1489 
1490 
1491 /*
1492 * Geometry constructors. These constructors to not copy the point arrays
1493 * passed to them, they just take references, so do not free them out
1494 * from underneath the geometries.
1495 */
1496 extern LWPOINT* lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point);
1497 extern LWMPOINT *lwmpoint_construct(int32_t srid, const POINTARRAY *pa);
1498 extern LWLINE* lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points);
1499 extern LWCIRCSTRING* lwcircstring_construct(int32_t srid, GBOX *bbox, POINTARRAY *points);
1500 extern LWPOLY* lwpoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points);
1501 extern LWCURVEPOLY* lwcurvepoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, LWGEOM **geoms);
1502 extern LWTRIANGLE* lwtriangle_construct(int32_t srid, GBOX *bbox, POINTARRAY *points);
1503 extern LWCOLLECTION* lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms);
1504 /*
1505 * Empty geometry constructors.
1506 */
1507 extern LWGEOM* lwgeom_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm);
1508 extern LWPOINT* lwpoint_construct_empty(int32_t srid, char hasz, char hasm);
1509 extern LWLINE* lwline_construct_empty(int32_t srid, char hasz, char hasm);
1510 extern LWPOLY* lwpoly_construct_empty(int32_t srid, char hasz, char hasm);
1511 extern LWCURVEPOLY* lwcurvepoly_construct_empty(int32_t srid, char hasz, char hasm);
1512 extern LWCIRCSTRING* lwcircstring_construct_empty(int32_t srid, char hasz, char hasm);
1513 extern LWCOMPOUND* lwcompound_construct_empty(int32_t srid, char hasz, char hasm);
1514 extern LWTRIANGLE* lwtriangle_construct_empty(int32_t srid, char hasz, char hasm);
1515 extern LWMPOINT* lwmpoint_construct_empty(int32_t srid, char hasz, char hasm);
1516 extern LWMLINE* lwmline_construct_empty(int32_t srid, char hasz, char hasm);
1517 extern LWMPOLY* lwmpoly_construct_empty(int32_t srid, char hasz, char hasm);
1518 extern LWCOLLECTION* lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm);
1519 
1520 
1521 /* Other constructors */
1522 extern LWPOINT *lwpoint_make2d(int32_t srid, double x, double y);
1523 extern LWPOINT *lwpoint_make3dz(int32_t srid, double x, double y, double z);
1524 extern LWPOINT *lwpoint_make3dm(int32_t srid, double x, double y, double m);
1525 extern LWPOINT *lwpoint_make4d(int32_t srid, double x, double y, double z, double m);
1526 extern LWPOINT *lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p);
1527 extern LWLINE *lwline_from_lwgeom_array(int32_t srid, uint32_t ngeoms, LWGEOM **geoms);
1528 extern LWLINE *lwline_from_ptarray(int32_t srid, uint32_t npoints, LWPOINT **points); /* TODO: deprecate */
1529 extern LWLINE *lwline_from_lwmpoint(int32_t srid, const LWMPOINT *mpoint);
1530 extern LWLINE *lwline_addpoint(LWLINE *line, LWPOINT *point, uint32_t where);
1531 extern LWLINE *lwline_removepoint(LWLINE *line, uint32_t which);
1532 extern void lwline_setPoint4d(LWLINE *line, uint32_t which, POINT4D *newpoint);
1533 extern LWPOLY *lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes);
1534 extern LWPOLY *lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D *p4);
1535 extern LWPOLY *lwpoly_construct_envelope(int32_t srid, double x1, double y1, double x2, double y2);
1536 extern LWPOLY *lwpoly_construct_circle(int32_t srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior);
1537 extern LWTRIANGLE *lwtriangle_from_lwline(const LWLINE *shell);
1538 extern LWMPOINT *lwmpoint_from_lwgeom(const LWGEOM *g); /* Extract the coordinates of an LWGEOM into an LWMPOINT */
1539 
1540 /* Some point accessors */
1541 extern double lwpoint_get_x(const LWPOINT *point);
1542 extern double lwpoint_get_y(const LWPOINT *point);
1543 extern double lwpoint_get_z(const LWPOINT *point);
1544 extern double lwpoint_get_m(const LWPOINT *point);
1545 
1549 extern int32_t lwgeom_get_srid(const LWGEOM *geom);
1550 
1554 extern int lwgeom_has_z(const LWGEOM *geom);
1555 
1559 extern int lwgeom_has_m(const LWGEOM *geom);
1560 
1564 extern int lwgeom_is_solid(const LWGEOM *geom);
1565 
1569 extern int lwgeom_ndims(const LWGEOM *geom);
1570 
1571 /*
1572  * Given a point, returns the location of closest point on pointarray
1573  * as a fraction of total length (0: first point -- 1: last point).
1574  *
1575  * If not-null, the third argument will be set to the actual distance
1576  * of the point from the pointarray.
1577  */
1578 extern double ptarray_locate_point(const POINTARRAY *pa, const POINT4D *pt, double *dist, POINT4D *p_located);
1579 
1584 extern LWLINE *lwline_measured_from_lwline(const LWLINE *lwline, double m_start, double m_end);
1585 extern LWMLINE* lwmline_measured_from_lwmline(const LWMLINE *lwmline, double m_start, double m_end);
1586 
1591 extern LWGEOM* lwgeom_locate_along(const LWGEOM *lwin, double m, double offset);
1592 
1598 extern LWCOLLECTION* lwgeom_locate_between(const LWGEOM *lwin, double from, double to, double offset);
1599 
1603 extern double lwgeom_interpolate_point(const LWGEOM *lwin, const LWPOINT *lwpt);
1604 
1615 extern double lwgeom_tcpa(const LWGEOM *g1, const LWGEOM *g2, double *mindist);
1616 
1622 extern int lwgeom_cpa_within(const LWGEOM *g1, const LWGEOM *g2, double maxdist);
1623 
1628 extern int lwgeom_is_trajectory(const LWGEOM *geom);
1629 extern int lwline_is_trajectory(const LWLINE *geom);
1630 
1631 /*
1632  * Ensure every segment is at most 'dist' long.
1633  * Returned LWGEOM might is unchanged if a POINT.
1634  */
1635 extern LWGEOM *lwgeom_segmentize2d(const LWGEOM *line, double dist);
1636 extern POINTARRAY *ptarray_segmentize2d(const POINTARRAY *ipa, double dist);
1637 extern LWLINE *lwline_segmentize2d(const LWLINE *line, double dist);
1638 extern LWPOLY *lwpoly_segmentize2d(const LWPOLY *line, double dist);
1639 extern LWCOLLECTION *lwcollection_segmentize2d(const LWCOLLECTION *coll, double dist);
1640 
1641 /*
1642  * Point density functions
1643  */
1644 extern LWMPOINT *lwpoly_to_points(const LWPOLY *poly, uint32_t npoints, int32_t seed);
1645 extern LWMPOINT *lwmpoly_to_points(const LWMPOLY *mpoly, uint32_t npoints, int32_t seed);
1646 extern LWMPOINT *lwgeom_to_points(const LWGEOM *lwgeom, uint32_t npoints, int32_t seed);
1647 
1648 /*
1649  * Geometric median
1650  */
1651 extern LWPOINT* lwgeom_median(const LWGEOM *g, double tol, uint32_t maxiter, char fail_if_not_converged);
1652 extern LWPOINT* lwmpoint_median(const LWMPOINT *g, double tol, uint32_t maxiter, char fail_if_not_converged);
1653 
1657 lwvarlena_t *lwgeom_geohash(const LWGEOM *lwgeom, int precision);
1658 unsigned int geohash_point_as_int(POINT2D *pt);
1659 
1660 
1672 };
1673 
1677 int lwline_crossing_direction(const LWLINE *l1, const LWLINE *l2);
1678 
1682 LWCOLLECTION* lwgeom_clip_to_ordinate_range(const LWGEOM *lwin, char ordinate, double from, double to, double offset);
1683 
1689 #define LW_GML_IS_DIMS (1<<0)
1691 #define LW_GML_IS_DEGREE (1<<1)
1693 #define LW_GML_SHORTLINE (1<<2)
1695 #define LW_GML_EXTENT (1<<4)
1696 
1697 
1698 #define IS_DIMS(x) ((x) & LW_GML_IS_DIMS)
1699 #define IS_DEGREE(x) ((x) & LW_GML_IS_DEGREE)
1707 #define LW_X3D_FLIP_XY (1<<0)
1708 #define LW_X3D_USE_GEOCOORDS (1<<1)
1709 #define X3D_USE_GEOCOORDS(x) ((x) & LW_X3D_USE_GEOCOORDS)
1710 
1711 
1712 
1713 extern lwvarlena_t* lwgeom_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix);
1714 extern lwvarlena_t* lwgeom_extent_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix);
1718 extern lwvarlena_t* lwgeom_extent_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix);
1719 extern lwvarlena_t* lwgeom_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix, const char *id);
1720 extern lwvarlena_t* lwgeom_to_kml2(const LWGEOM *geom, int precision, const char *prefix);
1721 extern lwvarlena_t* lwgeom_to_geojson(const LWGEOM *geo, const char *srs, int precision, int has_bbox);
1722 extern lwvarlena_t* lwgeom_to_x3d3(const LWGEOM *geom, int precision, int opts, const char *defid);
1723 extern lwvarlena_t* lwgeom_to_svg(const LWGEOM *geom, int precision, int relative);
1724 extern lwvarlena_t* lwgeom_to_encoded_polyline(const LWGEOM *geom, int precision);
1725 
1735 extern LWGEOM* lwgeom_from_geojson(const char *geojson, char **srs);
1736 
1742 extern LWGEOM* lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision);
1743 
1747 extern void spheroid_init(SPHEROID *s, double a, double b);
1748 
1754 extern double lwgeom_distance_spheroid(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, const SPHEROID *spheroid, double tolerance);
1755 
1759 extern LWPOINT* lwgeom_project_spheroid(const LWPOINT *r, const SPHEROID *spheroid, double distance, double azimuth);
1760 
1765 extern LWGEOM* lwgeom_segmentize_sphere(const LWGEOM *lwg_in, double max_seg_length);
1766 
1770 extern double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROID *spheroid);
1771 
1776 extern double lwgeom_area_sphere(const LWGEOM *lwgeom, const SPHEROID *spheroid);
1777 
1782 extern double lwgeom_area_spheroid(const LWGEOM *lwgeom, const SPHEROID *spheroid);
1783 
1788 extern double lwgeom_length_spheroid(const LWGEOM *geom, const SPHEROID *s);
1789 
1794 extern int lwgeom_covers_lwgeom_sphere(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2);
1795 
1796 typedef struct {
1798  double radius;
1800 
1802 
1803 /* Calculates the minimum circle that encloses all of the points in g, using a
1804  * two-dimensional implementation of the algorithm proposed in:
1805  *
1806  * Welzl, Emo (1991), "Smallest enclosing disks (balls and elipsoids)."
1807  * New Results and Trends in Computer Science (H. Maurer, Ed.), Lecture Notes
1808  * in Computer Science, 555 (1991) 359-370.
1809  *
1810  * Available online at the time of this writing at
1811  * https://www.inf.ethz.ch/personal/emo/PublFiles/SmallEnclDisk_LNCS555_91.pdf
1812  *
1813  * Returns NULL if the circle could not be calculated.
1814  */
1815 extern LWBOUNDINGCIRCLE* lwgeom_calculate_mbc(const LWGEOM* g);
1816 
1829 extern void lwgeom_swap_ordinates(LWGEOM *in, LWORD o1, LWORD o2);
1830 
1831 
1832 struct LWPOINTITERATOR;
1833 typedef struct LWPOINTITERATOR LWPOINTITERATOR;
1834 
1839 
1845 
1850 
1855 
1861 extern int lwpointiterator_modify_next(LWPOINTITERATOR* s, const POINT4D* p);
1862 
1870 
1876 
1877 
1881 extern uint8_t parse_hex(char *str);
1882 
1886 extern void deparse_hex(uint8_t str, char *result);
1887 
1888 
1889 
1890 /***********************************************************************
1891 ** Functions for managing serialized forms and bounding boxes.
1892 */
1893 
1897 extern int lwgeom_check_geodetic(const LWGEOM *geom);
1898 
1902 extern int lwgeom_nudge_geodetic(LWGEOM *geom);
1903 
1907 extern int lwgeom_force_geodetic(LWGEOM *geom);
1908 
1912 extern void lwgeom_set_geodetic(LWGEOM *geom, int value);
1913 
1920 extern int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox);
1921 
1927 extern int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox);
1928 
1933 extern int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox);
1934 
1938 extern int ptarray_calculate_gbox_geodetic(const POINTARRAY *pa, GBOX *gbox);
1939 
1943 extern int ptarray_calculate_gbox_cartesian(const POINTARRAY *pa, GBOX *gbox );
1944 
1948 int gbox_pt_outside(const GBOX *gbox, POINT2D *pt_outside);
1949 
1954 extern GBOX* gbox_new(lwflags_t flags);
1955 
1960 extern void gbox_init(GBOX *gbox);
1961 
1965 extern int gbox_merge(const GBOX *new_box, GBOX *merged_box);
1966 
1970 extern int gbox_union(const GBOX *g1, const GBOX *g2, GBOX *gout);
1971 
1975 extern void gbox_expand(GBOX *g, double d);
1976 
1980 extern void gbox_expand_xyzm(GBOX *g, double dx, double dy, double dz, double dm);
1981 
1985 extern int gbox_init_point3d(const POINT3D *p, GBOX *gbox);
1986 
1990 extern int gbox_merge_point3d(const POINT3D *p, GBOX *gbox);
1991 
1995 extern int gbox_contains_point3d(const GBOX *gbox, const POINT3D *pt);
1996 
2000 extern char* gbox_to_string(const GBOX *gbox);
2001 
2005 extern GBOX* gbox_copy(const GBOX *gbox);
2006 
2010 extern GBOX* gbox_from_string(const char *str);
2011 
2015 extern int gbox_overlaps(const GBOX *g1, const GBOX *g2);
2016 
2020 extern int gbox_overlaps_2d(const GBOX *g1, const GBOX *g2);
2021 
2025 extern int gbox_contains_2d(const GBOX *g1, const GBOX *g2);
2026 
2030 extern void gbox_duplicate(const GBOX *original, GBOX *duplicate);
2031 
2036 extern size_t gbox_serialized_size(lwflags_t flags);
2037 
2041 extern int gbox_same(const GBOX *g1, const GBOX *g2);
2042 
2046 extern int gbox_same_2d(const GBOX *g1, const GBOX *g2);
2047 
2052 extern int gbox_same_2d_float(const GBOX *g1, const GBOX *g2);
2053 
2060 extern void gbox_float_round(GBOX *gbox);
2061 
2065 extern int gbox_is_valid(const GBOX *gbox);
2066 
2070 extern uint64_t gbox_get_sortable_hash(const GBOX *g, const int32_t srid);
2071 
2075 extern uint64_t gserialized_get_sortable_hash(const GSERIALIZED *g);
2076 
2081 extern int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m);
2082 
2090 #define LW_PARSER_CHECK_MINPOINTS 1
2091 #define LW_PARSER_CHECK_ODD 2
2092 #define LW_PARSER_CHECK_CLOSURE 4
2093 #define LW_PARSER_CHECK_ZCLOSURE 8
2094 
2095 #define LW_PARSER_CHECK_NONE 0
2096 #define LW_PARSER_CHECK_ALL (LW_PARSER_CHECK_MINPOINTS | LW_PARSER_CHECK_ODD | LW_PARSER_CHECK_CLOSURE)
2097 
2103 {
2104  const char *wkinput; /* Copy of pointer to input WKT/WKB */
2105  uint8_t *serialized_lwgeom; /* Pointer to serialized LWGEOM */
2106  size_t size; /* Size of serialized LWGEOM in bytes */
2107  LWGEOM *geom; /* Pointer to LWGEOM struct */
2108  const char *message; /* Error/warning message */
2109  int errcode; /* Error/warning number */
2110  int errlocation; /* Location of error */
2111  int parser_check_flags; /* Bitmask of validity checks run during this parse */
2112 }
2114 
2115 /*
2116  * Parser error messages (these must match the message array in lwgparse.c)
2117  */
2118 #define PARSER_ERROR_MOREPOINTS 1
2119 #define PARSER_ERROR_ODDPOINTS 2
2120 #define PARSER_ERROR_UNCLOSED 3
2121 #define PARSER_ERROR_MIXDIMS 4
2122 #define PARSER_ERROR_INVALIDGEOM 5
2123 #define PARSER_ERROR_INVALIDWKBTYPE 6
2124 #define PARSER_ERROR_INCONTINUOUS 7
2125 #define PARSER_ERROR_TRIANGLEPOINTS 8
2126 #define PARSER_ERROR_LESSPOINTS 9
2127 #define PARSER_ERROR_OTHER 10
2128 
2129 
2130 
2131 /*
2132  * Unparser result structure: returns the result of attempting to convert LWGEOM to (E)WKT/(E)WKB
2133  */
2135 {
2136  uint8_t *serialized_lwgeom; /* Copy of pointer to input serialized LWGEOM */
2137  char *wkoutput; /* Pointer to WKT or WKB output */
2138  size_t size; /* Size of serialized LWGEOM in bytes */
2139  const char *message; /* Error/warning message */
2140  int errlocation; /* Location of error */
2141 }
2143 
2144 /*
2145  * Unparser error messages (these must match the message array in lwgunparse.c)
2146  */
2147 #define UNPARSER_ERROR_MOREPOINTS 1
2148 #define UNPARSER_ERROR_ODDPOINTS 2
2149 #define UNPARSER_ERROR_UNCLOSED 3
2150 
2151 
2152 /*
2153 ** Variants available for WKB and WKT output types
2154 */
2155 
2156 #define WKB_ISO 0x01
2157 #define WKB_SFSQL 0x02
2158 #define WKB_EXTENDED 0x04
2159 #define WKB_NDR 0x08
2160 #define WKB_XDR 0x10
2161 #define WKB_HEX 0x20
2162 #define WKB_NO_NPOINTS 0x40 /* Internal use only */
2163 #define WKB_NO_SRID 0x80 /* Internal use only */
2164 
2165 #define WKT_ISO 0x01
2166 #define WKT_SFSQL 0x02
2167 #define WKT_EXTENDED 0x04
2168 
2169 
2170 /*
2171 ** Variants available for TWKB
2172 */
2173 #define TWKB_BBOX 0x01 /* User wants bboxes */
2174 #define TWKB_SIZE 0x02 /* User wants sizes */
2175 #define TWKB_ID 0x04 /* User wants id */
2176 #define TWKB_NO_TYPE 0x10 /* No type because it is a sub geometry */
2177 #define TWKB_NO_ID 0x20 /* No ID because it is a subgeometry */
2178 #define TWKB_DEFAULT_PRECISION 0 /* Aim for 1m (or ft) rounding by default */
2179 
2180 /*
2181 ** New parsing and unparsing functions.
2182 */
2183 
2190 extern char* lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out);
2191 
2197 extern lwvarlena_t* lwgeom_to_wkt_varlena(const LWGEOM *geom, uint8_t variant, int precision);
2198 
2204 extern uint8_t* lwgeom_to_wkb_buffer(const LWGEOM *geom, uint8_t variant);
2205 extern lwvarlena_t* lwgeom_to_wkb_varlena(const LWGEOM *geom, uint8_t variant);
2206 
2213 extern char* lwgeom_to_hexwkb_buffer(const LWGEOM *geom, uint8_t variant);
2214 extern lwvarlena_t* lwgeom_to_hexwkb_varlena(const LWGEOM *geom, uint8_t variant);
2215 
2219 extern char *lwgeom_to_ewkt(const LWGEOM *lwgeom);
2220 
2226 extern LWGEOM* lwgeom_from_wkb(const uint8_t *wkb, const size_t wkb_size, const char check);
2227 
2232 extern LWGEOM* lwgeom_from_wkt(const char *wkt, const char check);
2233 
2237 extern LWGEOM* lwgeom_from_hexwkb(const char *hexwkb, const char check);
2238 
2239 extern uint8_t* bytes_from_hexbytes(const char *hexbuf, size_t hexsize);
2240 
2241 extern char* hexbytes_from_bytes(const uint8_t *bytes, size_t size);
2242 
2243 /*
2244 * WKT detailed parsing support
2245 */
2246 extern int lwgeom_parse_wkt(LWGEOM_PARSER_RESULT *parser_result, char *wktstr, int parse_flags);
2247 void lwgeom_parser_result_init(LWGEOM_PARSER_RESULT *parser_result);
2248 void lwgeom_parser_result_free(LWGEOM_PARSER_RESULT *parser_result);
2249 
2250 
2251 /* Memory management */
2252 extern void *lwalloc(size_t size);
2253 extern void *lwrealloc(void *mem, size_t size);
2254 extern void lwfree(void *mem);
2255 
2256 /* Utilities */
2257 extern char *lwmessage_truncate(char *str, int startpos, int endpos, int maxlength, int truncdirection);
2258 
2259 /*
2260 * TWKB functions
2261 */
2262 
2268 extern LWGEOM* lwgeom_from_twkb(const uint8_t *twkb, size_t twkb_size, char check);
2269 
2275 extern lwvarlena_t* lwgeom_to_twkb(const LWGEOM *geom, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m);
2276 
2277 extern lwvarlena_t* lwgeom_to_twkb_with_idlist(const LWGEOM *geom, int64_t *idlist, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m);
2278 
2291 extern void lwgeom_trim_bits_in_place(LWGEOM *geom, int32_t prec_x, int32_t prec_y, int32_t prec_z, int32_t prec_m);
2292 
2293 extern LWGEOM* lwgeom_boundary(LWGEOM* lwgeom);
2294 
2295 /*******************************************************************************
2296  * SQLMM internal functions
2297  ******************************************************************************/
2298 
2302 int lwgeom_has_arc(const LWGEOM *geom);
2308 int lwgeom_type_arc(const LWGEOM *geom);
2312 LWGEOM *lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad);
2317 LWGEOM *lwgeom_unstroke(const LWGEOM *geom);
2318 
2323 typedef enum {
2346 
2347 typedef enum {
2354 
2375 
2384 extern LWGEOM* lwcurve_linearize(const LWGEOM *geom, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags);
2385 
2386 /*******************************************************************************
2387  * GEOS proxy functions on LWGEOM
2388  ******************************************************************************/
2389 
2391 const char* lwgeom_geos_version(void);
2392 
2394 LWGEOM* lwgeom_geos_noop(const LWGEOM *geom) ;
2395 
2396 LWGEOM *lwgeom_normalize(const LWGEOM *geom);
2397 LWGEOM *lwgeom_intersection(const LWGEOM *geom1, const LWGEOM *geom2);
2398 LWGEOM *lwgeom_intersection_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize);
2399 LWGEOM *lwgeom_difference(const LWGEOM *geom1, const LWGEOM *geom2);
2400 LWGEOM *lwgeom_difference_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize);
2401 LWGEOM *lwgeom_symdifference(const LWGEOM* geom1, const LWGEOM* geom2);
2402 LWGEOM *lwgeom_symdifference_prec(const LWGEOM* geom1, const LWGEOM* geom2, double gridSize);
2403 LWGEOM *lwgeom_pointonsurface(const LWGEOM* geom);
2404 LWGEOM *lwgeom_reduceprecision(const LWGEOM* geom, double gridSize);
2405 LWGEOM *lwgeom_centroid(const LWGEOM* geom);
2406 LWGEOM *lwgeom_union(const LWGEOM *geom1, const LWGEOM *geom2);
2407 LWGEOM *lwgeom_union_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize);
2408 LWGEOM *lwgeom_linemerge(const LWGEOM *geom1);
2409 LWGEOM *lwgeom_unaryunion(const LWGEOM *geom1);
2410 LWGEOM *lwgeom_unaryunion_prec(const LWGEOM *geom1, double gridSize);
2411 LWGEOM *lwgeom_clip_by_rect(const LWGEOM *geom1, double x0, double y0, double x1, double y1);
2412 LWCOLLECTION *lwgeom_subdivide(const LWGEOM *geom, uint32_t maxvertices);
2413 LWCOLLECTION *lwgeom_subdivide_prec(const LWGEOM *geom, uint32_t maxvertices, double gridSize);
2414 
2422 LWGEOM* lwgeom_snap(const LWGEOM* geom1, const LWGEOM* geom2, double tolerance);
2423 
2424 /*
2425  * Return the set of paths shared between two linear geometries,
2426  * and their direction (same or opposite).
2427  *
2428  * @param geom1 a lineal geometry
2429  * @param geom2 another lineal geometry
2430  */
2431 LWGEOM* lwgeom_sharedpaths(const LWGEOM* geom1, const LWGEOM* geom2);
2432 
2433 /*
2434  * An offset curve against the input line.
2435  *
2436  * @param geom a lineal geometry or collection of them
2437  * @param size offset distance. Offset left if negative and right if positive
2438  * @param quadsegs number of quadrature segments in curves (try 8)
2439  * @param joinStyle (1 = round, 2 = mitre, 3 = bevel)
2440  * @param mitreLimit (try 5.0)
2441  * @return derived geometry (linestring or multilinestring)
2442  *
2443  */
2444 LWGEOM* lwgeom_offsetcurve(const LWGEOM *geom, double size, int quadsegs, int joinStyle, double mitreLimit);
2445 
2446 /*
2447  * Return true if the input geometry is "simple" as per OGC defn.
2448  *
2449  * @return 1 if simple, 0 if non-simple, -1 on exception (lwerror is called
2450  * in that case)
2451  */
2452 int lwgeom_is_simple(const LWGEOM *lwgeom);
2453 
2454 
2455 /*******************************************************************************
2456  * PROJ4-dependent extra functions on LWGEOM
2457  ******************************************************************************/
2458 
2459 int lwgeom_transform_from_str(LWGEOM *geom, const char* instr, const char* outstr);
2465 int lwgeom_transform(LWGEOM *geom, LWPROJ* pj);
2466 int ptarray_transform(POINTARRAY *pa, LWPROJ* pj);
2467 
2468 #if POSTGIS_PROJ_VERSION < 61
2474 projPJ projpj_from_string(const char* txt);
2475 
2476 #else // POSTGIS_PROJ_VERSION >= 61
2477 
2483 LWPROJ *lwproj_from_str(const char* str_in, const char* str_out);
2484 
2485 #endif
2486 
2487 
2488 /*******************************************************************************
2489  * GEOS-dependent extra functions on LWGEOM
2490  ******************************************************************************/
2491 
2499 LWGEOM* lwgeom_buildarea(const LWGEOM *geom) ;
2500 
2505 LWGEOM* lwgeom_make_valid_params(LWGEOM* geom, char *make_valid_params);
2506 
2507 /*
2508  * Split (multi)polygon by line; (multi)line by (multi)line,
2509  * (multi)point or (multi)polygon boundary.
2510  *
2511  * Collections are accepted as first argument.
2512  * Returns all obtained pieces as a collection.
2513  */
2514 LWGEOM* lwgeom_split(const LWGEOM* lwgeom_in, const LWGEOM* blade_in);
2515 
2516 /*
2517  * Fully node a set of linestrings, using the least nodes preserving
2518  * all the input ones.
2519  */
2520 LWGEOM* lwgeom_node(const LWGEOM* lwgeom_in);
2521 
2531 LWGEOM* lwgeom_delaunay_triangulation(const LWGEOM *geom, double tolerance, int32_t edgeOnly);
2532 
2542 LWGEOM* lwgeom_voronoi_diagram(const LWGEOM* g, const GBOX* env, double tolerance, int output_edges);
2543 
2553 int * lwgeom_cluster_kmeans(const LWGEOM **geoms, uint32_t n, uint32_t k, double max_radius);
2554 
2555 #include "lwinline.h"
2556 
2557 #endif /* !defined _LIBLWGEOM_H */
2558 
static uint8_t variant
Definition: cu_in_twkb.c:26
static uint8_t precision
Definition: cu_in_twkb.c:25
char * s
Definition: cu_in_wkt.c:23
char * r
Definition: cu_in_wkt.c:24
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
LWPOINT * lwpoint_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwpoint.c:151
void deparse_hex(uint8_t str, char *result)
Convert a char into a human readable hex digit.
Definition: lwgeom_api.c:618
LWPOLY * lwpoly_construct_circle(int32_t srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior)
Definition: lwpoly.c:120
int lwgeom_is_closed(const LWGEOM *geom)
Return true or false depending on whether a geometry is a linear feature that closes on itself.
Definition: lwgeom.c:1036
POINTARRAY * ptarray_construct_reference_data(char hasz, char hasm, uint32_t npoints, uint8_t *ptlist)
Construct a new POINTARRAY, referencing to the data from ptlist.
Definition: ptarray.c:291
int ptarray_remove_point(POINTARRAY *pa, uint32_t where)
Remove a point from an existing POINTARRAY.
Definition: ptarray.c:259
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:690
LW_LINEARIZE_TOLERANCE_TYPE
Semantic of the tolerance argument passed to lwcurve_linearize.
Definition: liblwgeom.h:2323
@ LW_LINEARIZE_TOLERANCE_TYPE_MAX_ANGLE
Tolerance expresses the maximum angle between the radii generating approximation line vertices,...
Definition: liblwgeom.h:2344
@ LW_LINEARIZE_TOLERANCE_TYPE_SEGS_PER_QUAD
Tolerance expresses the number of segments to use for each quarter of circle (quadrant).
Definition: liblwgeom.h:2329
@ LW_LINEARIZE_TOLERANCE_TYPE_MAX_DEVIATION
Tolerance expresses the maximum distance between an arbitrary point on the curve and the closest poin...
Definition: liblwgeom.h:2336
int lwpoint_getPoint4d_p(const LWPOINT *point, POINT4D *out)
Definition: lwpoint.c:57
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:162
LWGEOM * lwcompound_as_lwgeom(const LWCOMPOUND *obj)
Definition: lwgeom.c:307
LWPOINT * lwline_interpolate_point_3d(const LWLINE *line, double distance)
Interpolate one point along a line in 3D.
Definition: lwline.c:605
LWPOINT * lwcircstring_get_lwpoint(const LWCIRCSTRING *circ, uint32_t where)
Definition: lwcircstring.c:286
LWCURVEPOLY * lwcurvepoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, LWGEOM **geoms)
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition: lwgeom.c:947
POINTARRAY * ptarray_construct_copy_data(char hasz, char hasm, uint32_t npoints, const uint8_t *ptlist)
Construct a new POINTARRAY, copying in the data from ptlist.
Definition: ptarray.c:305
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:108
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:322
LWGEOM * lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed)
Simplification.
Definition: lwgeom.c:1876
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
Definition: lwgeom.c:574
int gbox_same(const GBOX *g1, const GBOX *g2)
Check if 2 given Gbox are the same.
Definition: gbox.c:164
int gbox_union(const GBOX *g1, const GBOX *g2, GBOX *gout)
Update the output GBOX to be large enough to include both inputs.
Definition: gbox.c:135
LWGEOM * lwgeom_centroid(const LWGEOM *geom)
void lwgeom_request_interrupt(void)
Request interruption of any running code.
Definition: lwgeom_api.c:664
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:292
int lwgeom_ndims(const LWGEOM *geom)
Return the number of dimensions (2, 3, 4) in a geometry.
Definition: lwgeom.c:938
uint32_t lwtype_get_collectiontype(uint8_t type)
Given an lwtype number, what homogeneous collection can hold it?
Definition: lwgeom.c:1114
LWORD_T
Ordinate names.
Definition: liblwgeom.h:144
@ LWORD_Z
Definition: liblwgeom.h:147
@ LWORD_M
Definition: liblwgeom.h:148
@ LWORD_Y
Definition: liblwgeom.h:146
@ LWORD_X
Definition: liblwgeom.h:145
void lwgeom_cancel_interrupt(void)
Cancel any interruption request.
Definition: lwgeom_api.c:668
void(*) typedef void(*) voi lwgeom_set_handlers)(lwallocator allocator, lwreallocator reallocator, lwfreeor freeor, lwreporter errorreporter, lwreporter noticereporter)
Install custom memory management and error handling functions you want your application to use.
size_t gbox_serialized_size(lwflags_t flags)
Return the number of bytes necessary to hold a GBOX of this dimension in serialized form.
Definition: gbox.c:440
LWGEOM * lwgeom_make_valid_params(LWGEOM *geom, char *make_valid_params)
void lwmpoly_release(LWMPOLY *lwpoly)
Definition: lwmpoly.c:34
int ptarray_closest_segment_2d(const POINTARRAY *pa, const POINT2D *qp, double *dist)
Definition: ptarray.c:1307
lwvarlena_t * lwgeom_to_kml2(const LWGEOM *geom, int precision, const char *prefix)
Definition: lwout_kml.c:44
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
Definition: lwgeom.c:910
LWGEOM * lwgeom_geos_noop(const LWGEOM *geom)
Convert an LWGEOM to a GEOS Geometry and convert back – for debug only.
void(*) typedef void(* lwdebuglogger)(int level, const char *fmt, va_list ap) __attribute__((format(printf
Definition: liblwgeom.h:261
void gbox_duplicate(const GBOX *original, GBOX *duplicate)
Copy the values of original GBOX into duplicate.
Definition: gbox.c:433
LWPOINT * lwpoint_make4d(int32_t srid, double x, double y, double z, double m)
Definition: lwpoint.c:195
LWGEOM * lwgeom_from_geojson(const char *geojson, char **srs)
Create an LWGEOM object from a GeoJSON representation.
Definition: lwin_geojson.c:411
LWGEOM * lwgeom_locate_along(const LWGEOM *lwin, double m, double offset)
Determine the location(s) along a measured line where m occurs and return as a multipoint.
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
Definition: measures.c:2397
int lwgeom_simplify_in_place(LWGEOM *igeom, double dist, int preserve_collapsed)
Definition: lwgeom.c:1743
LWGEOM * lwgeom_delaunay_triangulation(const LWGEOM *geom, double tolerance, int32_t edgeOnly)
Take vertices of a geometry and build a delaunay triangulation on them.
LWGEOM * lwgeom_closest_point(const LWGEOM *lw1, const LWGEOM *lw2)
Definition: measures.c:52
GBOX * gbox_copy(const GBOX *gbox)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: gbox.c:426
double lwgeom_maxdistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing max distance calculation.
Definition: measures.c:165
int gbox_same_2d(const GBOX *g1, const GBOX *g2)
Check if 2 given GBOX are the same in x and y.
Definition: gbox.c:179
int lwgeom_startpoint(const LWGEOM *lwgeom, POINT4D *pt)
Definition: lwgeom.c:2141
int ptarray_is_closed(const POINTARRAY *pa)
Check for ring closure using whatever dimensionality is declared on the pointarray.
Definition: ptarray.c:687
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
Definition: measures.c:2461
GBOX * box3d_to_gbox(const BOX3D *b3d)
Definition: gbox.c:80
LWPOINT * lwgeom_project_spheroid(const LWPOINT *r, const SPHEROID *spheroid, double distance, double azimuth)
Calculate the location of a point on a spheroid, give a start point, bearing and distance.
Definition: lwgeodetic.c:2101
void() lwinterrupt_callback()
Install a callback to be called periodically during algorithm execution.
Definition: liblwgeom.h:305
LWGEOM * lwgeom_node(const LWGEOM *lwgeom_in)
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
Definition: lwpoint.c:163
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
struct struct_lwgeom_unparser_result LWGEOM_UNPARSER_RESULT
void gbox_expand(GBOX *g, double d)
Move the box minimums down and the maximums up by the distance provided.
Definition: gbox.c:97
LWGEOM * lwgeom_symdifference(const LWGEOM *geom1, const LWGEOM *geom2)
LWGEOM * lwgeom_segmentize_sphere(const LWGEOM *lwg_in, double max_seg_length)
Derive a new geometry with vertices added to ensure no vertex is more than max_seg_length (in radians...
Definition: lwgeodetic.c:1745
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:242
int ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance)
Append a POINTARRAY, pa2 to the end of an existing POINTARRAY, pa1.
Definition: ptarray.c:177
int gbox_contains_point3d(const GBOX *gbox, const POINT3D *pt)
Return true if the point is inside the gbox.
Definition: gbox.c:247
LWGEOM * lwgeom_from_hexwkb(const char *hexwkb, const char check)
Definition: lwin_wkb.c:858
int ptarray_transform(POINTARRAY *pa, LWPROJ *pj)
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: gserialized.c:126
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:225
void lwgeom_set_srid(LWGEOM *geom, int32_t srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
Definition: lwgeom.c:1530
lwvarlena_t * lwgeom_to_svg(const LWGEOM *geom, int precision, int relative)
Takes a GEOMETRY and returns a SVG representation.
Definition: lwout_svg.c:56
double lwpoint_get_m(const LWPOINT *point)
Definition: lwpoint.c:107
void lwgeom_trim_bits_in_place(LWGEOM *geom, int32_t prec_x, int32_t prec_y, int32_t prec_z, int32_t prec_m)
Trim the bits of an LWGEOM in place, to optimize it for compression.
Definition: lwgeom.c:2548
LWLINE * lwline_segmentize2d(const LWLINE *line, double dist)
Definition: lwline.c:132
LWLINE * lwline_from_ptarray(int32_t srid, uint32_t npoints, LWPOINT **points)
Definition: lwline.c:228
void lwpoint_free(LWPOINT *pt)
Definition: lwpoint.c:213
void lwgeom_longitude_shift(LWGEOM *lwgeom)
Definition: lwgeom.c:991
double lwgeom_distance_spheroid(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, const SPHEROID *spheroid, double tolerance)
Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid.
Definition: lwgeodetic.c:2192
void gbox_float_round(GBOX *gbox)
Round given GBOX to float boundaries.
Definition: gbox.c:774
POINTARRAY * ptarray_substring(POINTARRAY *pa, double d1, double d2, double tolerance)
@d1 start location (distance from start / total distance) @d2 end location (distance from start / tot...
Definition: ptarray.c:1066
LWCOLLECTION * lwcollection_segmentize2d(const LWCOLLECTION *coll, double dist)
Definition: lwcollection.c:251
double distance3d_pt_seg(const POINT3D *p, const POINT3D *A, const POINT3D *B)
void lwpoint_release(LWPOINT *lwpoint)
Definition: lwpoint.c:256
int ptarray_closest_vertex_2d(const POINTARRAY *pa, const POINT2D *qp, double *dist)
Definition: ptarray.c:1340
int lwgeom_transform(LWGEOM *geom, LWPROJ *pj)
Transform (reproject) a geometry in-place.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
int ptarray_is_closed_3d(const POINTARRAY *pa)
Definition: ptarray.c:714
LWGEOM * lwcurve_linearize(const LWGEOM *geom, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition: lwstroke.c:838
char * hexbytes_from_bytes(const uint8_t *bytes, size_t size)
Definition: lwout_wkb.c:40
double lwgeom_maxdistance3d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling 3d max distance calculations and dfullywithin calculations.
Definition: measures3d.c:310
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)
int gbox_pt_outside(const GBOX *gbox, POINT2D *pt_outside)
Calculate a spherical point that falls outside the geocentric gbox.
Definition: lwgeodetic.c:1554
void lwmpoly_free(LWMPOLY *mpoly)
Definition: lwmpoly.c:53
LWGEOM * lwgeom_filter_m(LWGEOM *geom, double min, double max, int returnm)
Definition: lwmval.c:221
LWPOINT * lwpoint_make3dm(int32_t srid, double x, double y, double m)
Definition: lwpoint.c:184
uint32_t gserialized_get_version(const GSERIALIZED *g)
Return the serialization version.
Definition: gserialized.c:42
void(* lwfreeor)(void *mem)
Definition: liblwgeom.h:258
LWGEOM * lwgeom_as_multi(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate MULTI* type.
Definition: lwgeom.c:363
LWCURVEPOLY * lwcurvepoly_construct_from_lwpoly(LWPOLY *lwpoly)
Construct an equivalent curve polygon from a polygon.
Definition: lwcurvepoly.c:52
LWTIN * lwtin_add_lwtriangle(LWTIN *mobj, const LWTRIANGLE *obj)
Definition: lwtin.c:34
LWGEOM * lwgeom_unstroke(const LWGEOM *geom)
Convert linearized type into arc type, de-linearizing the strokes where possible.
Definition: lwstroke.c:1271
double lwgeom_perimeter_2d(const LWGEOM *geom)
Definition: lwgeom.c:1936
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point.
Definition: lwiterator.c:210
LWPOINT * lwcompound_get_lwpoint(const LWCOMPOUND *lwcmp, uint32_t where)
Definition: lwcompound.c:213
lwvarlena_t * lwgeom_geohash(const LWGEOM *lwgeom, int precision)
Calculate the GeoHash (http://geohash.org) string for a geometry.
Definition: lwalgorithm.c:863
int lwpoint_inside_circle(const LWPOINT *p, double cx, double cy, double rad)
Definition: lwgeom.c:645
LWGEOM * lwgeom_intersection(const LWGEOM *geom1, const LWGEOM *geom2)
void interpolate_point4d(const POINT4D *A, const POINT4D *B, POINT4D *I, double F)
Find interpolation point I between point A and point B so that the len(AI) == len(AB)*F and I falls o...
Definition: lwgeom_api.c:650
void lwtin_free(LWTIN *tin)
Definition: lwtin.c:39
LWGEOM * lwgeom_from_twkb(const uint8_t *twkb, size_t twkb_size, char check)
WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory...
Definition: lwin_twkb.c:654
LWGEOM * lwcollection_getsubgeom(LWCOLLECTION *col, int gnum)
Definition: lwcollection.c:114
POINTARRAY * ptarray_removePoint(POINTARRAY *pa, uint32_t where)
Remove a point from a pointarray.
Definition: ptarray.c:561
int lwpoint_getPoint3dm_p(const LWPOINT *point, POINT3DM *out)
Definition: lwpoint.c:52
void printLWPOLY(LWPOLY *poly)
Definition: lwpoly.c:193
lwvarlena_t * lwgeom_to_geojson(const LWGEOM *geo, const char *srs, int precision, int has_bbox)
Takes a GEOMETRY and returns a GeoJson representation.
Definition: lwout_geojson.c:49
LWGEOM * lwmline_as_lwgeom(const LWMLINE *obj)
Definition: lwgeom.c:282
LWGEOM * lwgeom_segmentize2d(const LWGEOM *line, double dist)
Definition: lwgeom.c:754
LWGEOM * lwgeom_offsetcurve(const LWGEOM *geom, double size, int quadsegs, int joinStyle, double mitreLimit)
void lwgeom_set_debuglogger(lwdebuglogger debuglogger)
Definition: lwutil.c:171
double lwgeom_interpolate_point(const LWGEOM *lwin, const LWPOINT *lwpt)
Find the measure value at the location on the line closest to the point.
POINT3DM getPoint3dm(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:202
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
Definition: lwgeodetic.c:3002
int gbox_merge_point3d(const POINT3D *p, GBOX *gbox)
Update the GBOX to be large enough to include itself and the new point.
Definition: gbox.c:228
lwvarlena_t * lwgeom_to_encoded_polyline(const LWGEOM *geom, int precision)
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:509
struct struct_lwgeom_parser_result LWGEOM_PARSER_RESULT
Parser result structure: returns the result of attempting to convert (E)WKT/(E)WKB to LWGEOM.
LWGEOM * lwgeom_furthest_line_3d(LWGEOM *lw1, LWGEOM *lw2)
Definition: measures3d.c:82
LWGEOM * lwgeom_closest_point_3d(const LWGEOM *lw1, const LWGEOM *lw2)
Definition: measures3d.c:88
BOX3D * box3d_from_gbox(const GBOX *gbox)
Definition: gbox.c:53
int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point)
Pull the first point values of a GSERIALIZED.
Definition: gserialized.c:257
uint16_t lwflags_t
Definition: liblwgeom.h:313
int gserialized_has_z(const GSERIALIZED *gser)
Check if a GSERIALIZED has a Z ordinate.
Definition: gserialized.c:174
LWGEOM * lwmpoint_as_lwgeom(const LWMPOINT *obj)
Definition: lwgeom.c:287
unsigned int geohash_point_as_int(POINT2D *pt)
Definition: lwalgorithm.c:664
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:312
void lwline_release(LWLINE *lwline)
Definition: lwline.c:125
double lwgeom_area_spheroid(const LWGEOM *lwgeom, const SPHEROID *spheroid)
Calculate the geodetic area of a lwgeom on the spheroid.
Definition: lwspheroid.c:647
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Convert type with arcs into equivalent linearized type.
Definition: lwstroke.c:871
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
Definition: gbox.c:740
int lwgeom_is_trajectory(const LWGEOM *geom)
Return LW_TRUE or LW_FALSE depending on whether or not a geometry is a linestring with measure value ...
Definition: lwgeom.c:2502
int gbox_overlaps(const GBOX *g1, const GBOX *g2)
Return LW_TRUE if the GBOX overlaps, LW_FALSE otherwise.
Definition: gbox.c:283
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwgeom_parser_result_init(LWGEOM_PARSER_RESULT *parser_result)
Definition: lwin_wkt.c:880
LWGEOM * lwgeom_force_sfs(LWGEOM *geom, int version)
Definition: lwgeom.c:832
char * lwmessage_truncate(char *str, int startpos, int endpos, int maxlength, int truncdirection)
Definition: lwutil.c:268
int lwgeom_parse_wkt(LWGEOM_PARSER_RESULT *parser_result, char *wktstr, int parse_flags)
Parse a WKT geometry string into an LWGEOM structure.
LWGEOM * lwgeom_furthest_point(const LWGEOM *lw1, const LWGEOM *lw2)
Definition: measures.c:58
int lwline_crossing_direction(const LWLINE *l1, const LWLINE *l2)
Given two lines, characterize how (and if) they cross each other.
Definition: lwalgorithm.c:462
int lwgeom_is_simple(const LWGEOM *lwgeom)
double lwpoint_get_x(const LWPOINT *point)
Definition: lwpoint.c:63
LWGEOM * lwgeom_snap(const LWGEOM *geom1, const LWGEOM *geom2, double tolerance)
Snap vertices and segments of a geometry to another using a given tolerance.
int lwpointiterator_peek(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assigns the next point in the iterator to p.
Definition: lwiterator.c:193
void lwtin_release(LWTIN *lwtin)
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
Definition: ptarray.c:634
void printPA(POINTARRAY *pa)
Definition: lwgeom_api.c:441
LWGEOM * lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
Create an LWGEOM object from an Encoded Polyline representation.
int lwgeom_check_geodetic(const LWGEOM *geom)
Check that coordinates of LWGEOM are all within the geodetic range (-180, -90, 180,...
Definition: lwgeodetic.c:3105
char * lwgeom_to_hexwkb_buffer(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:845
lwvarlena_t * lwgeom_to_twkb(const LWGEOM *geom, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m)
Definition: lwout_twkb.c:636
LWGEOM * lwgeom_difference(const LWGEOM *geom1, const LWGEOM *geom2)
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:512
GBOX * gbox_new(lwflags_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: gbox.c:32
const char * lwgeom_geos_version(void)
Return GEOS version string (not to be freed)
uint8_t * bytes_from_hexbytes(const char *hexbuf, size_t hexsize)
Definition: lwin_wkb.c:92
LWMLINE * lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj)
Definition: lwmline.c:46
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition: lwiterator.c:267
int gbox_overlaps_2d(const GBOX *g1, const GBOX *g2)
Return LW_TRUE if the GBOX overlaps on the 2d plane, LW_FALSE otherwise.
Definition: gbox.c:323
lwvarlena_t * lwgeom_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix)
VERSION GML 2 takes a GEOMETRY and returns a GML2 representation.
Definition: lwout_gml.c:259
int lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa)
Add a ring, allocating extra space if necessary.
Definition: lwpoly.c:247
double ptarray_locate_point(const POINTARRAY *pa, const POINT4D *pt, double *dist, POINT4D *p_located)
Definition: ptarray.c:1373
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: gserialized.c:152
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:243
int lwgeom_remove_repeated_points_in_place(LWGEOM *in, double tolerance)
Definition: lwgeom.c:1587
LWGEOM * lwgeom_force_3dm(const LWGEOM *geom, double mval)
Definition: lwgeom.c:788
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
Definition: lwgeom_api.c:343
int lwgeom_has_srid(const LWGEOM *geom)
Return true or false depending on whether a geometry has a valid SRID set.
Definition: lwgeom.c:1387
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: gbox.c:40
LWGEOM * lwgeom_force_4d(const LWGEOM *geom, double zval, double mval)
Definition: lwgeom.c:794
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
Definition: ptarray.c:51
double lwgeom_length(const LWGEOM *geom)
Definition: lwgeom.c:1958
LWGEOM * lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
Definition: lwgeom.c:1454
void gbox_expand_xyzm(GBOX *g, double dx, double dy, double dz, double dm)
Move the box minimums down and the maximums up by the distances provided.
Definition: gbox.c:115
const char * lwgeom_version(void)
Return lwgeom version string (not to be freed)
Definition: lwgeom_api.c:39
const float * gserialized_get_float_box_p(const GSERIALIZED *g, size_t *ndims)
Access to the float bounding box, if there is one.
Definition: gserialized.c:248
void gserialized_set_srid(GSERIALIZED *g, int32_t srid)
Write the SRID into the serialized form (it is packed into three bytes so this is a handy function).
Definition: gserialized.c:138
int lwgeom_needs_bbox(const LWGEOM *geom)
Check whether or not a lwgeom is big enough to warrant a bounding box.
Definition: lwgeom.c:1191
LWMLINE * lwmline_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwmline.c:38
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box)
Pull a GBOX from the header of a GSERIALIZED, if one is available.
Definition: gserialized.c:65
LWGEOM * lwgeom_reverse(const LWGEOM *lwgeom)
Definition: lwgeom.c:94
LWMPOINT * lwpoly_to_points(const LWPOLY *poly, uint32_t npoints, int32_t seed)
double ptarray_length_2d(const POINTARRAY *pts)
Find the 2d length of the given POINTARRAY (even if it's 3d)
Definition: ptarray.c:1819
LWGEOM * lwpsurface_as_lwgeom(const LWPSURFACE *obj)
Definition: lwgeom.c:272
LWGEOM * lwgeom_force_3dz(const LWGEOM *geom, double zval)
Definition: lwgeom.c:782
int lwgeom_covers_lwgeom_sphere(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
Calculate covers predicate for two lwgeoms on the sphere.
Definition: lwgeodetic.c:2418
lwvarlena_t * lwgeom_extent_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix)
Definition: lwout_gml.c:247
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:917
lwvarlena_t * lwgeom_extent_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:240
LWGEOM * lwmpoly_as_lwgeom(const LWMPOLY *obj)
Definition: lwgeom.c:277
int lwtype_is_collection(uint8_t type)
Determine whether a type number is a collection or not.
Definition: lwgeom.c:1088
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:548
void printBOX3D(BOX3D *b)
Definition: lwgeom_api.c:435
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
Definition: lwgeom.c:665
int lwgeom_isfinite(const LWGEOM *lwgeom)
Check if a LWGEOM has any non-finite (NaN or Inf) coordinates.
Definition: lwgeom.c:2690
LWPOINT * lwcompound_get_startpoint(const LWCOMPOUND *lwcmp)
Definition: lwcompound.c:248
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:42
int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m)
Utility function to get type number from string.
Definition: lwutil.c:489
void lwgeom_scale(LWGEOM *geom, const POINT4D *factors)
Definition: lwgeom.c:2057
LWTRIANGLE * lwtriangle_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwtriangle.c:58
LWTRIANGLE * lwtriangle_from_lwline(const LWLINE *shell)
Definition: lwtriangle.c:153
uint8_t * lwgeom_to_wkb_buffer(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:815
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
Definition: lwgeom_debug.c:166
double lwgeom_tcpa(const LWGEOM *g1, const LWGEOM *g2, double *mindist)
Find the time of closest point of approach.
void lwmline_release(LWMLINE *lwline)
Definition: lwmline.c:32
LWGEOM * lwgeom_pointonsurface(const LWGEOM *geom)
LWBOUNDINGCIRCLE * lwgeom_calculate_mbc(const LWGEOM *g)
int gbox_init_point3d(const POINT3D *p, GBOX *gbox)
Initialize a GBOX using the values of the point.
Definition: gbox.c:239
LWGEOM * lwgeom_sharedpaths(const LWGEOM *geom1, const LWGEOM *geom2)
int pt_in_ring_2d(const POINT2D *p, const POINTARRAY *ring)
Definition: lwalgorithm.c:282
LWPOLY * lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D *p4)
Definition: lwpoly.c:80
LWTRIANGLE * lwgeom_as_lwtriangle(const LWGEOM *lwgeom)
Definition: lwgeom.c:207
void(* lwreporter)(const char *fmt, va_list ap) __attribute__((format(printf
Definition: liblwgeom.h:259
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:45
LWLINE * lwline_addpoint(LWLINE *line, LWPOINT *point, uint32_t where)
double lwgeom_area(const LWGEOM *geom)
Definition: lwgeom.c:1891
int lwgeom_type_arc(const LWGEOM *geom)
Geometry type is one of the potentially "arc containing" types (circstring, multicurve,...
Definition: lwstroke.c:89
LWMLINE * lwgeom_as_lwmline(const LWGEOM *lwgeom)
Definition: lwgeom.c:234
LWMPOLY * lwmpoly_add_lwpoly(LWMPOLY *mobj, const LWPOLY *obj)
Definition: lwmpoly.c:47
LWGEOM * lwgeom_voronoi_diagram(const LWGEOM *g, const GBOX *env, double tolerance, int output_edges)
Take vertices of a geometry and build the Voronoi diagram.
int ptarray_insert_point(POINTARRAY *pa, const POINT4D *p, uint32_t where)
Insert a point into an existing POINTARRAY.
Definition: ptarray.c:85
LWPOLY * lwpoly_construct_envelope(int32_t srid, double x1, double y1, double x2, double y2)
Definition: lwpoly.c:98
LWPSURFACE * lwpsurface_add_lwpoly(LWPSURFACE *mobj, const LWPOLY *obj)
Definition: lwpsurface.c:33
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition: lwgeom.c:1229
LWPROJ * lwproj_from_str(const char *str_in, const char *str_out)
Allocate a new LWPROJ containing the reference to the PROJ's PJ If extra_geography_data is true,...
int gserialized_is_geodetic(const GSERIALIZED *gser)
Check if a GSERIALIZED is a geography.
Definition: gserialized.c:196
int ptarray_calculate_gbox_cartesian(const POINTARRAY *pa, GBOX *gbox)
Calculate box (x/y) and add values to gbox.
Definition: gbox.c:601
void printLWTIN(LWTIN *tin)
Definition: lwtin.c:57
LW_LINEARIZE_FLAGS
Definition: liblwgeom.h:2347
@ LW_LINEARIZE_FLAG_SYMMETRIC
Symmetric linearization means that the output vertices would be the same no matter the order of the p...
Definition: liblwgeom.h:2353
@ LW_LINEARIZE_FLAG_RETAIN_ANGLE
Retain angle instructs the engine to try its best to retain the requested angle between generating ra...
Definition: liblwgeom.h:2373
int * lwgeom_cluster_kmeans(const LWGEOM **geoms, uint32_t n, uint32_t k, double max_radius)
Take a list of LWGEOMs and a number of clusters and return an integer array indicating which cluster ...
Definition: lwkmeans.c:321
double distance3d_pt_pt(const POINT3D *p1, const POINT3D *p2)
Definition: measures3d.c:1032
int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *point)
Definition: lwgeom_api.c:216
int lwpointiterator_modify_next(LWPOINTITERATOR *s, const POINT4D *p)
Attempts to replace the next point int the iterator with p, and advances the iterator to the next poi...
Definition: lwiterator.c:224
POINTARRAY * lwline_interpolate_points(const LWLINE *line, double length_fraction, char repeat)
Interpolate one or more points along a line.
Definition: lwline.c:528
int lwgeom_dimension(const LWGEOM *geom)
For an LWGEOM, returns 0 for points, 1 for lines, 2 for polygons, 3 for volume, and the max dimension...
Definition: lwgeom.c:1281
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, uint32_t maxvertices)
Definition: lwgeom.c:2494
LWGEOM * lwgeom_chaikin(const LWGEOM *igeom, int n_iterations, int preserve_endpoint)
Definition: lwchaikins.c:182
LWGEOM * lwgeom_difference_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize)
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:235
int lwpoint_getPoint3dz_p(const LWPOINT *point, POINT3DZ *out)
Definition: lwpoint.c:47
uint64_t gbox_get_sortable_hash(const GBOX *g, const int32_t srid)
Return a sortable key based on the center point of the GBOX.
Definition: gbox.c:796
LWGEOM * lwgeom_homogenize(const LWGEOM *geom)
Definition: lwhomogenize.c:208
void lwfree(void *mem)
Definition: lwutil.c:242
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:327
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
Definition: measures.c:207
LWGEOM * lwgeom_unaryunion(const LWGEOM *geom1)
LWGEOM * lwgeom_union_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize)
LWGEOM * lwgeom_as_curve(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate CURVE* type.
Definition: lwgeom.c:403
int ptarray_calculate_gbox_geodetic(const POINTARRAY *pa, GBOX *gbox)
Calculate geodetic (x/y/z) box and add values to gbox.
Definition: lwgeodetic.c:2863
LWCOLLECTION * lwcollection_extract(const LWCOLLECTION *col, uint32_t type)
Definition: lwcollection.c:432
LWGEOM * lwgeom_normalize(const LWGEOM *geom)
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
LWPOINT * lwpoint_make3dz(int32_t srid, double x, double y, double z)
Definition: lwpoint.c:173
void lwcircstring_free(LWCIRCSTRING *curve)
Definition: lwcircstring.c:97
LWMPOINT * lwmpoint_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwmpoint.c:39
uint64_t gserialized_get_sortable_hash(const GSERIALIZED *g)
Return a sortable key based on gserialized.
Definition: gserialized.c:391
double lwgeom_mindistance3d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling 3d min distance calculations and dwithin calculations.
Definition: measures3d.c:442
int gserialized_fast_gbox_p(const GSERIALIZED *g, GBOX *box)
Pull a GBOX from the header of a GSERIALIZED, if one is available.
Definition: gserialized.c:77
void lwgeom_swap_ordinates(LWGEOM *in, LWORD o1, LWORD o2)
Swap ordinate values in every vertex of the geometry.
Definition: lwgeom.c:1461
int lwgeom_transform_from_str(LWGEOM *geom, const char *instr, const char *outstr)
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:2003
LWCOLLECTION * lwgeom_clip_to_ordinate_range(const LWGEOM *lwin, char ordinate, double from, double to, double offset)
Given a geometry clip based on the from/to range of one of its ordinates (x, y, z,...
int gserialized_ndims(const GSERIALIZED *gser)
Return the number of dimensions (2, 3, 4) in a geometry.
Definition: gserialized.c:207
LWMPOINT * lwmpoly_to_points(const LWMPOLY *mpoly, uint32_t npoints, int32_t seed)
LWGEOM * lwgeom_closest_line(const LWGEOM *lw1, const LWGEOM *lw2)
Definition: measures.c:40
LWGEOM * lwgeom_unaryunion_prec(const LWGEOM *geom1, double gridSize)
uint8_t lwtype_multitype(uint8_t type)
Definition: lwgeom.c:353
LWPOINT * lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
void spheroid_init(SPHEROID *s, double a, double b)
Initialize a spheroid object for use in geodetic functions.
Definition: lwspheroid.c:39
LWGEOM * lwgeom_boundary(LWGEOM *lwgeom)
Definition: lwgeom.c:2569
#define __attribute__(x)
Definition: liblwgeom.h:242
LWGEOM * lwgeom_buildarea(const LWGEOM *geom)
Take a geometry and return an areal geometry (Polygon or MultiPolygon).
void lwtriangle_free(LWTRIANGLE *triangle)
Definition: lwtriangle.c:69
int lwcurvepoly_add_ring(LWCURVEPOLY *poly, LWGEOM *ring)
Add a ring, allocating extra space if necessary.
Definition: lwcurvepoly.c:71
void *(* lwreallocator)(void *mem, size_t size)
Definition: liblwgeom.h:257
LWCURVEPOLY * lwgeom_as_lwcurvepoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:189
LWPOINTITERATOR * lwpointiterator_create_rw(LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM* Supports modification of coordinates during iterat...
Definition: lwiterator.c:251
CG_LINE_CROSS_TYPE
The return values of lwline_crossing_direction()
Definition: liblwgeom.h:1664
@ LINE_MULTICROSS_END_RIGHT
Definition: liblwgeom.h:1669
@ LINE_MULTICROSS_END_SAME_FIRST_LEFT
Definition: liblwgeom.h:1670
@ LINE_MULTICROSS_END_LEFT
Definition: liblwgeom.h:1668
@ LINE_CROSS_LEFT
Definition: liblwgeom.h:1666
@ LINE_MULTICROSS_END_SAME_FIRST_RIGHT
Definition: liblwgeom.h:1671
@ LINE_CROSS_RIGHT
Definition: liblwgeom.h:1667
@ LINE_NO_CROSS
Definition: liblwgeom.h:1665
void lwboundingcircle_destroy(LWBOUNDINGCIRCLE *c)
void *(* lwallocator)(size_t size)
Global functions for memory/logging handlers.
Definition: liblwgeom.h:256
void lwcollection_release(LWCOLLECTION *lwcollection)
Definition: lwcollection.c:36
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: gserialized.c:89
GSERIALIZED * gserialized_set_gbox(GSERIALIZED *g, GBOX *gbox)
Copy a new bounding box into an existing gserialized.
Definition: gserialized.c:31
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:59
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
int gserialized_has_m(const GSERIALIZED *gser)
Check if a GSERIALIZED has an M ordinate.
Definition: gserialized.c:185
double lwgeom_length_2d(const LWGEOM *geom)
Definition: lwgeom.c:1980
uint32_t lwgeom_count_rings(const LWGEOM *geom)
Count the total number of rings in any LWGEOM.
Definition: lwgeom.c:1339
int lwgeom_force_geodetic(LWGEOM *geom)
Force coordinates of LWGEOM into geodetic range (-180, -90, 180, 90)
Definition: lwgeodetic.c:3196
double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing min distance calculation.
Definition: measures.c:197
int ptarray_is_closed_z(const POINTARRAY *pa)
Definition: ptarray.c:727
char * lwpoint_to_latlon(const LWPOINT *p, const char *format)
Definition: lwprint.c:437
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
LWGEOM * lwgeom_symdifference_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize)
POINT3DZ getPoint3dz(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:188
void lwgeom_force_clockwise(LWGEOM *lwgeom)
Force Right-hand-rule on LWGEOM polygons.
Definition: lwgeom.c:38
int gserialized_has_bbox(const GSERIALIZED *gser)
Check if a GSERIALIZED has a bounding box without deserializing first.
Definition: gserialized.c:163
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:357
void printLWLINE(LWLINE *line)
Definition: lwline.c:79
int lwgeom_is_solid(const LWGEOM *geom)
Return LW_TRUE if geometry has SOLID flag.
Definition: lwgeom.c:931
uint32_t gserialized_max_header_size(void)
Returns the size in bytes to read from toast to get the basic information from a geometry: GSERIALIZE...
Definition: gserialized.c:101
GBOX * gbox_from_string(const char *str)
Warning, do not use this function, it is very particular about inputs.
Definition: gbox.c:364
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:126
int lwcollection_ngeoms(const LWCOLLECTION *col)
Definition: lwcollection.c:319
double distance2d_sqr_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B)
Definition: measures.c:2407
LWGEOM * lwgeom_intersection_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize)
LWCOLLECTION * lwgeom_locate_between(const LWGEOM *lwin, double from, double to, double offset)
Determine the segments along a measured line that fall within the m-range given.
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:327
LWLINE * lwline_from_lwmpoint(int32_t srid, const LWMPOINT *mpoint)
Definition: lwline.c:275
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:704
int lwgeom_nudge_geodetic(LWGEOM *geom)
Gently move coordinates of LWGEOM if they are close enough into geodetic range.
Definition: lwgeodetic.c:3378
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
Definition: lwgeom.c:726
GSERIALIZED * gserialized_drop_gbox(GSERIALIZED *g)
Remove the bounding box from a GSERIALIZED.
Definition: gserialized.c:52
void lwcircstring_release(LWCIRCSTRING *lwcirc)
Definition: lwcircstring.c:91
LWGEOM * lwgeom_set_effective_area(const LWGEOM *igeom, int set_area, double area)
LWGEOM * lwtin_as_lwgeom(const LWTIN *obj)
Definition: lwgeom.c:267
LWPOLY * lwpoly_segmentize2d(const LWPOLY *line, double dist)
Definition: lwpoly.c:312
POINT2D getPoint2d(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:329
LWGEOM * lwcurvepoly_as_lwgeom(const LWCURVEPOLY *obj)
Definition: lwgeom.c:302
lwvarlena_t * lwgeom_to_hexwkb_varlena(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:875
struct lwvarlena_t lwvarlena_t
LWTIN * lwgeom_as_lwtin(const LWGEOM *lwgeom)
Definition: lwgeom.c:260
void lwpoly_release(LWPOLY *lwpoly)
Definition: lwpoly.c:306
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:474
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
Definition: lwgeom.c:738
LWGEOM * lwcircstring_as_lwgeom(const LWCIRCSTRING *obj)
Definition: lwgeom.c:297
LWPSURFACE * lwgeom_as_lwpsurface(const LWGEOM *lwgeom)
Definition: lwgeom.c:252
void lwline_setPoint4d(LWLINE *line, uint32_t which, POINT4D *newpoint)
Definition: lwline.c:364
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:905
LWCOLLECTION * lwcollection_concat_in_place(LWCOLLECTION *col1, const LWCOLLECTION *col2)
Appends all geometries from col2 to col1 in place.
Definition: lwcollection.c:241
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition: ptarray.c:147
LWMPOINT * lwmpoint_from_lwgeom(const LWGEOM *g)
Definition: lwmpoint.c:93
void expand_box3d(BOX3D *box, double d)
Expand given box of 'd' units in all directions.
Definition: lwgeom_box3d.c:344
void lwgeom_add_bbox_deep(LWGEOM *lwgeom, GBOX *gbox)
Compute a box for geom and all sub-geometries, if not already computed.
Definition: lwgeom.c:697
int lwpointiterator_has_next(LWPOINTITERATOR *s)
Returns LW_TRUE if there is another point available in the iterator.
Definition: lwiterator.c:202
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:188
double lwgeom_length_spheroid(const LWGEOM *geom, const SPHEROID *s)
Calculate the geodetic length of a lwgeom on the unit sphere.
Definition: lwgeodetic.c:3271
LWPOINT * lwmpoint_median(const LWMPOINT *g, double tol, uint32_t maxiter, char fail_if_not_converged)
LWGEOM * lwgeom_linemerge(const LWGEOM *geom1)
LWGEOM * lwgeom_furthest_line(const LWGEOM *lw1, const LWGEOM *lw2)
Definition: measures.c:46
void printLWPOINT(LWPOINT *point)
Definition: lwpoint.c:224
void * lwalloc(size_t size)
Definition: lwutil.c:227
int lwgeom_dimensionality(const LWGEOM *geom)
Return the dimensionality (relating to point/line/poly) of an lwgeom.
Definition: lwgeom.c:1409
uint8_t parse_hex(char *str)
Convert a single hex digit into the corresponding char.
Definition: lwgeom_api.c:483
LWCOMPOUND * lwcompound_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwcompound.c:123
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:42
int lwcompound_add_lwgeom(LWCOMPOUND *comp, LWGEOM *geom)
Add a component, allocating extra space if necessary.
Definition: lwcompound.c:88
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:701
double lwgeom_maxdistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling max distance calculations and dfullywithin calculations.
Definition: measures.c:177
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:216
LWLINE * lwline_measured_from_lwline(const LWLINE *lwline, double m_start, double m_end)
Add a measure dimension to a line, interpolating linearly from the start to the end value.
Definition: lwline.c:379
LWGEOM * lwgeom_clip_by_rect(const LWGEOM *geom1, double x0, double y0, double x1, double y1)
LWGEOM * lwtriangle_as_lwgeom(const LWTRIANGLE *obj)
Definition: lwgeom.c:317
LWCIRCSTRING * lwgeom_as_lwcircstring(const LWGEOM *lwgeom)
Definition: lwgeom.c:171
LWGEOM * lwgeom_wrapx(const LWGEOM *lwgeom, double cutx, double amount)
wrap geometry on given cut x value
Definition: lwgeom_wrapx.c:169
void lwpsurface_free(LWPSURFACE *psurf)
Definition: lwpsurface.c:39
float next_float_up(double d)
Definition: lwgeom_api.c:75
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:175
LWGEOM * lwgeom_reduceprecision(const LWGEOM *geom, double gridSize)
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition: lwutil.c:471
LWPOINT * lwgeom_median(const LWGEOM *g, double tol, uint32_t maxiter, char fail_if_not_converged)
LWMPOINT * lwgeom_to_points(const LWGEOM *lwgeom, uint32_t npoints, int32_t seed)
double lwpoint_get_z(const LWPOINT *point)
Definition: lwpoint.c:89
void lwmline_free(LWMLINE *mline)
Definition: lwmline.c:112
void lwpsurface_release(LWPSURFACE *lwpsurface)
int lwline_is_trajectory(const LWLINE *geom)
Definition: lwline.c:454
void printLWTRIANGLE(LWTRIANGLE *triangle)
Definition: lwtriangle.c:82
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:198
int getPoint3dm_p(const POINTARRAY *pa, uint32_t n, POINT3DM *point)
Definition: lwgeom_api.c:269
double lwgeom_maxdistance3d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing 3d max distance calculation.
Definition: measures3d.c:300
int gbox_same_2d_float(const GBOX *g1, const GBOX *g2)
Check if two given GBOX are the same in x and y, or would round to the same GBOX in x and if serializ...
Definition: gbox.c:187
LWMLINE * lwmline_measured_from_lwmline(const LWMLINE *lwmline, double m_start, double m_end)
Re-write the measure ordinate (or add one, if it isn't already there) interpolating the measure betwe...
Definition: lwmline.c:56
lwvarlena_t * lwgeom_to_twkb_with_idlist(const LWGEOM *geom, int64_t *idlist, uint8_t variant, int8_t precision_xy, int8_t precision_z, int8_t precision_m)
Convert LWGEOM to a char* in TWKB format.
Definition: lwout_twkb.c:589
LWCURVEPOLY * lwcurvepoly_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwcurvepoly.c:35
void lwgeom_release(LWGEOM *lwgeom)
Free the containing LWGEOM and the associated BOX.
Definition: lwgeom.c:451
double lwgeom_perimeter(const LWGEOM *geom)
Definition: lwgeom.c:1914
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
Definition: lwpoly.c:360
LWGEOM * lwgeom_from_wkb(const uint8_t *wkb, const size_t wkb_size, const char check)
WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory...
Definition: lwin_wkb.c:834
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:924
struct LWPROJ LWPROJ
LWCOLLECTION * lwgeom_subdivide_prec(const LWGEOM *geom, uint32_t maxvertices, double gridSize)
Definition: lwgeom.c:2471
int gbox_is_valid(const GBOX *gbox)
Return false if any of the dimensions is NaN or infinite.
Definition: gbox.c:197
struct gridspec_t gridspec
Snap-to-grid.
LWCOMPOUND * lwcompound_construct_from_lwline(const LWLINE *lwpoly)
Construct an equivalent compound curve from a linestring.
Definition: lwcompound.c:204
double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROID *spheroid)
Calculate the bearing between two points on a spheroid.
Definition: lwgeodetic.c:2158
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
Definition: gserialized.c:222
lwvarlena_t * lwgeom_to_x3d3(const LWGEOM *geom, int precision, int opts, const char *defid)
Definition: lwout_x3d.c:37
lwvarlena_t * lwgeom_to_wkb_varlena(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:851
LWPOLY * lwpoly_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwpoly.c:161
LWPOLY * lwpoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:43
lwflags_t gserialized_get_lwflags(const GSERIALIZED *g)
Read standard lwflags from gserialized.
Definition: gserialized.c:18
LWGEOM * lwgeom_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwgeom.c:2111
LWGEOM * lwgeom_grid(const LWGEOM *lwgeom, const gridspec *grid)
Definition: lwgeom.c:2273
int lwgeom_is_clockwise(LWGEOM *lwgeom)
Ensure the outer ring is clockwise oriented and all inner rings are counter-clockwise.
Definition: lwgeom.c:66
LWCIRCSTRING * lwcircstring_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwcircstring.c:79
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:370
LWLINE * lwline_removepoint(LWLINE *line, uint32_t which)
Definition: lwline.c:347
LWMPOINT * lwmpoint_construct(int32_t srid, const POINTARRAY *pa)
Definition: lwmpoint.c:52
int32_t gserialized_hash(const GSERIALIZED *g)
Returns a hash code for the srid/type/geometry information in the GSERIALIZED.
Definition: gserialized.c:114
POINTARRAY * ptarray_merge(POINTARRAY *pa1, POINTARRAY *pa2)
Merge two given POINTARRAY and returns a pointer on the new aggregate one.
Definition: ptarray.c:603
int lwpoint_getPoint2d_p(const LWPOINT *point, POINT2D *out)
Definition: lwpoint.c:40
LWMPOLY * lwmpoly_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwmpoly.c:40
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:678
float next_float_down(double d)
Definition: lwgeom_api.c:54
void lwline_free(LWLINE *line)
Definition: lwline.c:67
int gserialized_cmp(const GSERIALIZED *g1, const GSERIALIZED *g2)
Return -1 if g1 is "less than" g2, 1 if g1 is "greater than" g2 and 0 if g1 and g2 are the "same".
Definition: gserialized.c:313
LWCIRCSTRING * lwcircstring_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition: lwcircstring.c:50
POINTARRAY * ptarray_flip_coordinates(POINTARRAY *pa)
Reverse X and Y axis on a given POINTARRAY.
Definition: ptarray.c:368
LWGEOM * lwgeom_union(const LWGEOM *geom1, const LWGEOM *geom2)
LWLINE * lwline_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwline.c:55
void lwgeom_parser_result_free(LWGEOM_PARSER_RESULT *parser_result)
Definition: lwin_wkt.c:886
LWTRIANGLE * lwtriangle_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition: lwtriangle.c:40
int gbox_contains_2d(const GBOX *g1, const GBOX *g2)
Return LW_TRUE if the first GBOX contains the second on the 2d plane, LW_FALSE otherwise.
Definition: gbox.c:339
LWLINE * lwline_from_lwgeom_array(int32_t srid, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwline.c:151
POINTARRAY * ptarray_segmentize2d(const POINTARRAY *ipa, double dist)
Returns a modified POINTARRAY so that no segment is longer than the given distance (computed using 2d...
Definition: ptarray.c:413
int lwgeom_has_arc(const LWGEOM *geom)
Geometry includes at least one actual circular arc.
Definition: lwstroke.c:55
int32_t clamp_srid(int32_t srid)
Return a valid SRID from an arbitrary integer Raises a notice if what comes out is different from wha...
Definition: lwutil.c:333
void lwmpoint_release(LWMPOINT *lwpoint)
Definition: lwmpoint.c:33
char * gbox_to_string(const GBOX *gbox)
Allocate a string representation of the GBOX, based on dimensionality of flags.
Definition: gbox.c:392
LWPOINT * lwcompound_get_endpoint(const LWCOMPOUND *lwcmp)
Definition: lwcompound.c:254
void lwtriangle_release(LWTRIANGLE *lwtriangle)
Definition: lwtriangle.c:119
double lwpoint_get_y(const LWPOINT *point)
Definition: lwpoint.c:76
double lwgeom_area_sphere(const LWGEOM *lwgeom, const SPHEROID *spheroid)
Calculate the geodetic area of a lwgeom on the sphere.
Definition: lwgeodetic.c:2033
void printLWPSURFACE(LWPSURFACE *psurf)
Definition: lwpsurface.c:57
LWGEOM * lwgeom_make_valid(LWGEOM *geom)
Attempts to make an invalid geometries valid w/out losing points.
LWGEOM * lwgeom_closest_line_3d(const LWGEOM *lw1, const LWGEOM *lw2)
Definition: measures3d.c:76
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
Definition: lwgeom.c:776
int lwline_add_lwpoint(LWLINE *line, LWPOINT *point, uint32_t where)
Add a LWPOINT to an LWLINE.
Definition: lwline.c:327
lwvarlena_t * lwgeom_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:727
void lwgeom_drop_srid(LWGEOM *lwgeom)
Definition: lwgeom.c:748
void lwgeom_grid_in_place(LWGEOM *lwgeom, const gridspec *grid)
Definition: lwgeom.c:2172
lwinterrupt_callback * lwgeom_register_interrupt_callback(lwinterrupt_callback *)
Definition: lwgeom_api.c:674
void lwgeom_reverse_in_place(LWGEOM *lwgeom)
Reverse vertex order of LWGEOM.
Definition: lwgeom.c:103
double lwgeom_mindistance3d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing 3d min distance calculation.
Definition: measures3d.c:335
int lwgeom_cpa_within(const LWGEOM *g1, const LWGEOM *g2, double maxdist)
Is the closest point of approach within a distance ?
int gbox_merge(const GBOX *new_box, GBOX *merged_box)
Update the merged GBOX to be large enough to include itself and the new box.
Definition: gbox.c:257
LWPOINT * lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p)
Definition: lwpoint.c:206
lwvarlena_t * lwgeom_to_wkt_varlena(const LWGEOM *geom, uint8_t variant, int precision)
Definition: lwout_wkt.c:717
enum LWORD_T LWORD
Ordinate names.
LWCOMPOUND * lwgeom_as_lwcompound(const LWGEOM *lwgeom)
Definition: lwgeom.c:180
LWPOINT * lwline_get_lwpoint(const LWLINE *line, uint32_t where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition: lwline.c:309
#define str(s)
static double distance(double x1, double y1, double x2, double y2)
Definition: lwtree.c:1032
int value
Definition: genraster.py:62
opts
Definition: ovdump.py:45
type
Definition: ovdump.py:42
data
Definition: ovdump.py:104
def fmt
Definition: pixval.py:93
double afac
Definition: liblwgeom.h:346
double xmax
Definition: liblwgeom.h:354
double xmin
Definition: liblwgeom.h:353
int32_t srid
Definition: liblwgeom.h:355
double ymax
Definition: liblwgeom.h:371
double zmax
Definition: liblwgeom.h:373
double xmax
Definition: liblwgeom.h:369
double zmin
Definition: liblwgeom.h:372
double mmax
Definition: liblwgeom.h:375
double ymin
Definition: liblwgeom.h:370
double xmin
Definition: liblwgeom.h:368
double mmin
Definition: liblwgeom.h:374
lwflags_t flags
Definition: liblwgeom.h:367
uint32_t size
Definition: liblwgeom.h:458
uint8_t gflags
Definition: liblwgeom.h:460
POINT2D * center
Definition: liblwgeom.h:1797
uint8_t type
Definition: liblwgeom.h:524
int32_t srid
Definition: liblwgeom.h:522
lwflags_t flags
Definition: liblwgeom.h:523
POINTARRAY * points
Definition: liblwgeom.h:521
GBOX * bbox
Definition: liblwgeom.h:520
lwflags_t flags
Definition: liblwgeom.h:591
uint32_t ngeoms
Definition: liblwgeom.h:594
uint32_t maxgeoms
Definition: liblwgeom.h:595
uint8_t type
Definition: liblwgeom.h:592
GBOX * bbox
Definition: liblwgeom.h:588
LWGEOM ** geoms
Definition: liblwgeom.h:589
int32_t srid
Definition: liblwgeom.h:590
uint32_t maxgeoms
Definition: liblwgeom.h:609
lwflags_t flags
Definition: liblwgeom.h:605
int32_t srid
Definition: liblwgeom.h:604
GBOX * bbox
Definition: liblwgeom.h:602
uint32_t ngeoms
Definition: liblwgeom.h:608
uint8_t type
Definition: liblwgeom.h:606
LWGEOM ** geoms
Definition: liblwgeom.h:603
int32_t srid
Definition: liblwgeom.h:618
GBOX * bbox
Definition: liblwgeom.h:616
uint8_t type
Definition: liblwgeom.h:620
LWGEOM ** rings
Definition: liblwgeom.h:617
lwflags_t flags
Definition: liblwgeom.h:619
uint32_t nrings
Definition: liblwgeom.h:622
uint32_t maxrings
Definition: liblwgeom.h:623
void * data
Definition: liblwgeom.h:473
uint8_t type
Definition: liblwgeom.h:476
GBOX * bbox
Definition: liblwgeom.h:472
int32_t srid
Definition: liblwgeom.h:474
lwflags_t flags
Definition: liblwgeom.h:475
lwflags_t flags
Definition: liblwgeom.h:499
GBOX * bbox
Definition: liblwgeom.h:496
POINTARRAY * points
Definition: liblwgeom.h:497
uint8_t type
Definition: liblwgeom.h:500
int32_t srid
Definition: liblwgeom.h:498
uint32_t maxgeoms
Definition: liblwgeom.h:637
LWGEOM ** geoms
Definition: liblwgeom.h:631
GBOX * bbox
Definition: liblwgeom.h:630
lwflags_t flags
Definition: liblwgeom.h:633
uint32_t ngeoms
Definition: liblwgeom.h:636
int32_t srid
Definition: liblwgeom.h:632
uint8_t type
Definition: liblwgeom.h:634
uint32_t maxgeoms
Definition: liblwgeom.h:567
lwflags_t flags
Definition: liblwgeom.h:563
GBOX * bbox
Definition: liblwgeom.h:560
int32_t srid
Definition: liblwgeom.h:562
LWLINE ** geoms
Definition: liblwgeom.h:561
uint8_t type
Definition: liblwgeom.h:564
uint32_t ngeoms
Definition: liblwgeom.h:566
uint32_t maxgeoms
Definition: liblwgeom.h:553
int32_t srid
Definition: liblwgeom.h:548
GBOX * bbox
Definition: liblwgeom.h:546
lwflags_t flags
Definition: liblwgeom.h:549
uint32_t ngeoms
Definition: liblwgeom.h:552
LWPOINT ** geoms
Definition: liblwgeom.h:547
uint8_t type
Definition: liblwgeom.h:550
uint8_t type
Definition: liblwgeom.h:578
GBOX * bbox
Definition: liblwgeom.h:574
uint32_t maxgeoms
Definition: liblwgeom.h:581
uint32_t ngeoms
Definition: liblwgeom.h:580
LWPOLY ** geoms
Definition: liblwgeom.h:575
lwflags_t flags
Definition: liblwgeom.h:577
int32_t srid
Definition: liblwgeom.h:576
uint8_t type
Definition: liblwgeom.h:648
int32_t srid
Definition: liblwgeom.h:646
uint32_t maxgeoms
Definition: liblwgeom.h:651
GBOX * bbox
Definition: liblwgeom.h:644
uint32_t ngeoms
Definition: liblwgeom.h:650
lwflags_t flags
Definition: liblwgeom.h:647
LWGEOM ** geoms
Definition: liblwgeom.h:645
POINTARRAY * point
Definition: liblwgeom.h:485
uint8_t type
Definition: liblwgeom.h:488
lwflags_t flags
Definition: liblwgeom.h:487
GBOX * bbox
Definition: liblwgeom.h:484
int32_t srid
Definition: liblwgeom.h:486
POINTARRAY ** rings
Definition: liblwgeom.h:533
uint8_t type
Definition: liblwgeom.h:536
uint32_t maxrings
Definition: liblwgeom.h:539
uint32_t nrings
Definition: liblwgeom.h:538
GBOX * bbox
Definition: liblwgeom.h:532
lwflags_t flags
Definition: liblwgeom.h:535
int32_t srid
Definition: liblwgeom.h:534
uint8_t source_is_latlong
Definition: liblwgeom.h:62
double source_semi_major_metre
Definition: liblwgeom.h:64
double source_semi_minor_metre
Definition: liblwgeom.h:65
PJ * pj
Definition: liblwgeom.h:60
lwflags_t flags
Definition: liblwgeom.h:661
uint32_t maxgeoms
Definition: liblwgeom.h:665
LWPOLY ** geoms
Definition: liblwgeom.h:659
uint32_t ngeoms
Definition: liblwgeom.h:664
uint8_t type
Definition: liblwgeom.h:662
int32_t srid
Definition: liblwgeom.h:660
GBOX * bbox
Definition: liblwgeom.h:658
uint32_t ngeoms
Definition: liblwgeom.h:678
int32_t srid
Definition: liblwgeom.h:674
uint8_t type
Definition: liblwgeom.h:676
lwflags_t flags
Definition: liblwgeom.h:675
LWTRIANGLE ** geoms
Definition: liblwgeom.h:673
uint32_t maxgeoms
Definition: liblwgeom.h:679
GBOX * bbox
Definition: liblwgeom.h:672
int32_t srid
Definition: liblwgeom.h:510
uint8_t type
Definition: liblwgeom.h:512
GBOX * bbox
Definition: liblwgeom.h:508
lwflags_t flags
Definition: liblwgeom.h:511
POINTARRAY * points
Definition: liblwgeom.h:509
double x
Definition: liblwgeom.h:404
double m
Definition: liblwgeom.h:422
double x
Definition: liblwgeom.h:410
double x
Definition: liblwgeom.h:416
double m
Definition: liblwgeom.h:428
lwflags_t flags
Definition: liblwgeom.h:445
uint32_t maxpoints
Definition: liblwgeom.h:442
uint32_t npoints
Definition: liblwgeom.h:441
uint8_t * serialized_pointlist
Definition: liblwgeom.h:448
double e_sq
Definition: liblwgeom.h:393
double e
Definition: liblwgeom.h:392
double radius
Definition: liblwgeom.h:394
double a
Definition: liblwgeom.h:389
double b
Definition: liblwgeom.h:390
double f
Definition: liblwgeom.h:391
double ipm
Definition: liblwgeom.h:1386
double zsize
Definition: liblwgeom.h:1389
double ysize
Definition: liblwgeom.h:1388
double xsize
Definition: liblwgeom.h:1387
double ipx
Definition: liblwgeom.h:1383
double msize
Definition: liblwgeom.h:1390
double ipy
Definition: liblwgeom.h:1384
double ipz
Definition: liblwgeom.h:1385
Snap-to-grid.
Definition: liblwgeom.h:1382
uint32_t size
Definition: liblwgeom.h:321
char data[]
Definition: liblwgeom.h:322
Parser result structure: returns the result of attempting to convert (E)WKT/(E)WKB to LWGEOM.
Definition: liblwgeom.h:2103