GEOS  3.9.1dev
geos_c.h
Go to the documentation of this file.
1 /************************************************************************
2  *
3  *
4  * C-Wrapper for GEOS library
5  *
6  * Copyright (C) 2010 2011 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2005 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  * Author: Sandro Santilli <strk@kbt.io>
15  *
16  ***********************************************************************
17  *
18  * GENERAL NOTES:
19  *
20  * - Remember to call initGEOS() before any use of this library's
21  * functions, and call finishGEOS() when done.
22  *
23  * - Currently you have to explicitly GEOSGeom_destroy() all
24  * GEOSGeom objects to avoid memory leaks, and GEOSFree()
25  * all returned char * (unless const).
26  *
27  * - Functions ending with _r are thread safe; see details in RFC 3
28  * http://trac.osgeo.org/geos/wiki/RFC3.
29  * To avoid using by accident non _r functions,
30  * define GEOS_USE_ONLY_R_API before including geos_c.h
31  *
32  ***********************************************************************/
33 
34 #ifndef GEOS_C_H_INCLUDED
35 #define GEOS_C_H_INCLUDED
36 
37 #ifndef __cplusplus
38 # include <stddef.h> /* for size_t definition */
39 #else
40 # include <cstddef>
41 using std::size_t;
42 #endif
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /************************************************************************
49  *
50  * Version
51  *
52  ***********************************************************************/
53 
54 #ifndef GEOS_VERSION_MAJOR
55 #define GEOS_VERSION_MAJOR 3
56 #endif
57 #ifndef GEOS_VERSION_MINOR
58 #define GEOS_VERSION_MINOR 9
59 #endif
60 #ifndef GEOS_VERSION_PATCH
61 #define GEOS_VERSION_PATCH 1dev
62 #endif
63 #ifndef GEOS_VERSION
64 #define GEOS_VERSION "3.9.1dev"
65 #endif
66 #ifndef GEOS_JTS_PORT
67 #define GEOS_JTS_PORT "1.17.0"
68 #endif
69 
70 #define GEOS_CAPI_VERSION_MAJOR 1
71 #define GEOS_CAPI_VERSION_MINOR 14
72 #define GEOS_CAPI_VERSION_PATCH 1
73 #define GEOS_CAPI_VERSION "3.9.1dev-CAPI-1.14.1"
74 
75 #define GEOS_CAPI_FIRST_INTERFACE GEOS_CAPI_VERSION_MAJOR
76 #define GEOS_CAPI_LAST_INTERFACE (GEOS_CAPI_VERSION_MAJOR+GEOS_CAPI_VERSION_MINOR)
77 
78 
79 /************************************************************************
80  *
81  * (Abstract) type definitions
82  *
83  ************************************************************************/
84 
85 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
86 
87 typedef void (*GEOSMessageHandler)(const char *fmt, ...);
88 
89 /*
90  * A GEOS message handler function.
91  *
92  * @param message the message contents
93  * @param userdata the user data pointer that was passed to GEOS when registering this message handler.
94  *
95  *
96  * @see GEOSContext_setErrorMessageHandler
97  * @see GEOSContext_setNoticeMessageHandler
98  */
99 typedef void (*GEOSMessageHandler_r)(const char *message, void *userdata);
100 
101 /* When we're included by geos_c.cpp, those are #defined to the original
102  * JTS definitions via preprocessor. We don't touch them to allow the
103  * compiler to cross-check the declarations. However, for all "normal"
104  * C-API users, we need to define them as "opaque" struct pointers, as
105  * those clients don't have access to the original C++ headers, by design.
106  */
107 #ifndef GEOSGeometry
108 typedef struct GEOSGeom_t GEOSGeometry;
109 typedef struct GEOSPrepGeom_t GEOSPreparedGeometry;
110 typedef struct GEOSCoordSeq_t GEOSCoordSequence;
111 typedef struct GEOSSTRtree_t GEOSSTRtree;
112 typedef struct GEOSBufParams_t GEOSBufferParams;
113 #endif
114 
115 /* Those are compatibility definitions for source compatibility
116  * with GEOS 2.X clients relying on that type.
117  */
120 
121 /* Supported geometry types
122  * This was renamed from GEOSGeomTypeId in GEOS 2.2.X, which might
123  * break compatibility, this issue is still under investigation.
124  */
125 
135 };
136 
137 /* Byte orders exposed via the C API */
139  GEOS_WKB_XDR = 0, /* Big Endian */
140  GEOS_WKB_NDR = 1 /* Little Endian */
141 };
142 
143 typedef void (*GEOSQueryCallback)(void *item, void *userdata);
144 typedef int (*GEOSDistanceCallback)(const void *item1, const void* item2, double* distance, void* userdata);
145 
146 /************************************************************************
147  *
148  * Initialization, cleanup, version
149  *
150  ***********************************************************************/
151 
152 #include <geos/export.h>
153 
154 /*
155  * Register an interruption checking callback
156  *
157  * The callback will be invoked _before_ checking for
158  * interruption, so can be used to request it.
159  */
160 typedef void (GEOSInterruptCallback)();
162 /* Request safe interruption of operations */
163 extern void GEOS_DLL GEOS_interruptRequest();
164 /* Cancel a pending interruption request */
165 extern void GEOS_DLL GEOS_interruptCancel();
166 
167 /*
168  * @deprecated in 3.5.0
169  * initialize using GEOS_init_r() and set the message handlers using
170  * GEOSContext_setNoticeHandler_r and/or GEOSContext_setErrorHandler_r
171  */
172 extern GEOSContextHandle_t GEOS_DLL initGEOS_r(
173  GEOSMessageHandler notice_function,
174  GEOSMessageHandler error_function);
175 /*
176  * @deprecated in 3.5.0 replaced by GEOS_finish_r.
177  */
178 extern void GEOS_DLL finishGEOS_r(GEOSContextHandle_t handle);
179 
180 extern GEOSContextHandle_t GEOS_DLL GEOS_init_r();
181 extern void GEOS_DLL GEOS_finish_r(GEOSContextHandle_t handle);
182 
183 
184 extern GEOSMessageHandler GEOS_DLL GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle,
185  GEOSMessageHandler nf);
186 extern GEOSMessageHandler GEOS_DLL GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle,
187  GEOSMessageHandler ef);
188 
189 /*
190  * Sets a notice message handler on the given GEOS context.
191  *
192  * @param extHandle the GEOS context
193  * @param nf the message handler
194  * @param userData optional user data pointer that will be passed to the message handler
195  *
196  * @return the previously configured message handler or NULL if no message handler was configured
197  */
198 extern GEOSMessageHandler_r GEOS_DLL GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t extHandle,
200  void *userData);
201 
202 /*
203  * Sets an error message handler on the given GEOS context.
204  *
205  * @param extHandle the GEOS context
206  * @param ef the message handler
207  * @param userData optional user data pointer that will be passed to the message handler
208  *
209  * @return the previously configured message handler or NULL if no message handler was configured
210  */
211 extern GEOSMessageHandler_r GEOS_DLL GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t extHandle,
213  void *userData);
214 
215 extern const char GEOS_DLL *GEOSversion();
216 
217 
218 /************************************************************************
219  *
220  * NOTE - These functions are DEPRECATED. Please use the new Reader and
221  * writer APIS!
222  *
223  ***********************************************************************/
224 
225 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKT_r(GEOSContextHandle_t handle,
226  const char *wkt);
227 extern char GEOS_DLL *GEOSGeomToWKT_r(GEOSContextHandle_t handle,
228  const GEOSGeometry* g);
229 
230 /*
231  * Specify whether output WKB should be 2d or 3d.
232  * Return previously set number of dimensions.
233  */
234 
235 extern int GEOS_DLL GEOS_getWKBOutputDims_r(GEOSContextHandle_t handle);
236 extern int GEOS_DLL GEOS_setWKBOutputDims_r(GEOSContextHandle_t handle,
237  int newDims);
238 
239 /*
240  * Specify whether the WKB byte order is big or little endian.
241  * The return value is the previous byte order.
242  */
243 
244 extern int GEOS_DLL GEOS_getWKBByteOrder_r(GEOSContextHandle_t handle);
245 extern int GEOS_DLL GEOS_setWKBByteOrder_r(GEOSContextHandle_t handle,
246  int byteOrder);
247 
248 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKB_buf_r(GEOSContextHandle_t handle,
249  const unsigned char *wkb,
250  size_t size);
251 extern unsigned char GEOS_DLL *GEOSGeomToWKB_buf_r(GEOSContextHandle_t handle,
252  const GEOSGeometry* g,
253  size_t *size);
254 
255 extern GEOSGeometry GEOS_DLL *GEOSGeomFromHEX_buf_r(GEOSContextHandle_t handle,
256  const unsigned char *hex,
257  size_t size);
258 extern unsigned char GEOS_DLL *GEOSGeomToHEX_buf_r(GEOSContextHandle_t handle,
259  const GEOSGeometry* g,
260  size_t *size);
261 
262 /************************************************************************
263  *
264  * Coordinate Sequence functions
265  *
266  ***********************************************************************/
267 
268 /*
269  * Create a Coordinate sequence with ``size'' coordinates
270  * of ``dims'' dimensions.
271  * Return NULL on exception.
272  */
274  GEOSContextHandle_t handle,
275  unsigned int size,
276  unsigned int dims);
277 
278 /*
279  * Clone a Coordinate Sequence.
280  * Return NULL on exception.
281  */
283  GEOSContextHandle_t handle,
284  const GEOSCoordSequence* s);
285 
286 /*
287  * Destroy a Coordinate Sequence.
288  */
289 extern void GEOS_DLL GEOSCoordSeq_destroy_r(GEOSContextHandle_t handle,
290  GEOSCoordSequence* s);
291 
292 /*
293  * Set ordinate values in a Coordinate Sequence.
294  * Return 0 on exception.
295  */
296 extern int GEOS_DLL GEOSCoordSeq_setX_r(GEOSContextHandle_t handle,
297  GEOSCoordSequence* s, unsigned int idx,
298  double val);
299 extern int GEOS_DLL GEOSCoordSeq_setY_r(GEOSContextHandle_t handle,
300  GEOSCoordSequence* s, unsigned int idx,
301  double val);
302 extern int GEOS_DLL GEOSCoordSeq_setZ_r(GEOSContextHandle_t handle,
303  GEOSCoordSequence* s, unsigned int idx,
304  double val);
305 extern int GEOS_DLL GEOSCoordSeq_setXY_r(GEOSContextHandle_t handle,
306  GEOSCoordSequence* s, unsigned int idx,
307  double x, double y);
308 extern int GEOS_DLL GEOSCoordSeq_setXYZ_r(GEOSContextHandle_t handle,
309  GEOSCoordSequence* s, unsigned int idx,
310  double x, double y, double z);
311 
312 extern int GEOS_DLL GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t handle,
314  unsigned int idx,
315  unsigned int dim, double val);
316 
317 /*
318  * Get ordinate values from a Coordinate Sequence.
319  * Return 0 on exception.
320  */
321 extern int GEOS_DLL GEOSCoordSeq_getX_r(GEOSContextHandle_t handle,
322  const GEOSCoordSequence* s,
323  unsigned int idx, double *val);
324 extern int GEOS_DLL GEOSCoordSeq_getY_r(GEOSContextHandle_t handle,
325  const GEOSCoordSequence* s,
326  unsigned int idx, double *val);
327 extern int GEOS_DLL GEOSCoordSeq_getZ_r(GEOSContextHandle_t handle,
328  const GEOSCoordSequence* s,
329  unsigned int idx, double *val);
330 extern int GEOS_DLL GEOSCoordSeq_getXY_r(GEOSContextHandle_t handle,
331  const GEOSCoordSequence* s,
332  unsigned int idx, double *x, double *y);
333 extern int GEOS_DLL GEOSCoordSeq_getXYZ_r(GEOSContextHandle_t handle,
334  const GEOSCoordSequence* s,
335  unsigned int idx, double *x, double *y, double *z);
336 extern int GEOS_DLL GEOSCoordSeq_getOrdinate_r(GEOSContextHandle_t handle,
337  const GEOSCoordSequence* s,
338  unsigned int idx,
339  unsigned int dim, double *val);
340 /*
341  * Get size and dimensions info from a Coordinate Sequence.
342  * Return 0 on exception.
343  */
344 extern int GEOS_DLL GEOSCoordSeq_getSize_r(GEOSContextHandle_t handle,
345  const GEOSCoordSequence* s,
346  unsigned int *size);
347 extern int GEOS_DLL GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t handle,
348  const GEOSCoordSequence* s,
349  unsigned int *dims);
350 /*
351  * Check orientation of a CoordinateSequence and set 'is_ccw' to 1
352  * if it has counter-clockwise orientation, 0 otherwise.
353  * Return 0 on exception, 1 on success.
354  */
355 extern int GEOS_DLL GEOSCoordSeq_isCCW_r(GEOSContextHandle_t handle,
356  const GEOSCoordSequence* s,
357  char* is_ccw);
358 
359 /************************************************************************
360  *
361  * Linear referencing functions -- there are more, but these are
362  * probably sufficient for most purposes
363  *
364  ***********************************************************************/
365 
366 /*
367  * GEOSGeometry ownership is retained by caller
368  */
369 
370 
371 /* Return distance of point 'p' projected on 'g' from origin
372  * of 'g'. Geometry 'g' must be a lineal geometry.
373  * Return -1 on exception*/
374 extern double GEOS_DLL GEOSProject_r(GEOSContextHandle_t handle,
375  const GEOSGeometry *g,
376  const GEOSGeometry *p);
377 
378 /* Return closest point to given distance within geometry
379  * Geometry must be a LineString */
380 extern GEOSGeometry GEOS_DLL *GEOSInterpolate_r(GEOSContextHandle_t handle,
381  const GEOSGeometry *g,
382  double d);
383 
384 extern double GEOS_DLL GEOSProjectNormalized_r(GEOSContextHandle_t handle,
385  const GEOSGeometry *g,
386  const GEOSGeometry *p);
387 
389  GEOSContextHandle_t handle,
390  const GEOSGeometry *g,
391  double d);
392 
393 /************************************************************************
394  *
395  * Buffer related functions
396  *
397  ***********************************************************************/
398 
399 
400 /* @return NULL on exception */
401 extern GEOSGeometry GEOS_DLL *GEOSBuffer_r(GEOSContextHandle_t handle,
402  const GEOSGeometry* g,
403  double width, int quadsegs);
404 
409 };
410 
415 };
416 
417 /* @return 0 on exception */
419  GEOSContextHandle_t handle);
421  GEOSContextHandle_t handle,
422  GEOSBufferParams* parms);
423 
424 /* @return 0 on exception */
426  GEOSContextHandle_t handle,
427  GEOSBufferParams* p,
428  int style);
429 
430 /* @return 0 on exception */
432  GEOSContextHandle_t handle,
433  GEOSBufferParams* p,
434  int joinStyle);
435 
436 /* @return 0 on exception */
438  GEOSContextHandle_t handle,
439  GEOSBufferParams* p,
440  double mitreLimit);
441 
442 /* @return 0 on exception */
444  GEOSContextHandle_t handle,
445  GEOSBufferParams* p,
446  int quadSegs);
447 
448 /* @param singleSided: 1 for single sided, 0 otherwise */
449 /* @return 0 on exception */
451  GEOSContextHandle_t handle,
452  GEOSBufferParams* p,
453  int singleSided);
454 
455 /* @return NULL on exception */
457  GEOSContextHandle_t handle,
458  const GEOSGeometry* g,
459  const GEOSBufferParams* p,
460  double width);
461 
462 /* These functions return NULL on exception. */
463 extern GEOSGeometry GEOS_DLL *GEOSBufferWithStyle_r(GEOSContextHandle_t handle,
464  const GEOSGeometry* g, double width, int quadsegs, int endCapStyle,
465  int joinStyle, double mitreLimit);
466 
467 /* These functions return NULL on exception. Only LINESTRINGs are accepted. */
468 /* @deprecated in 3.3.0: use GEOSOffsetCurve instead */
470  GEOSContextHandle_t handle,
471  const GEOSGeometry* g, double width, int quadsegs,
472  int joinStyle, double mitreLimit, int leftSide);
473 
474 /*
475  * Only LINESTRINGs are accepted.
476  * @param width : offset distance.
477  * negative for right side offset.
478  * positive for left side offset.
479  * @return NULL on exception
480  */
481 extern GEOSGeometry GEOS_DLL *GEOSOffsetCurve_r(GEOSContextHandle_t handle,
482  const GEOSGeometry* g, double width, int quadsegs,
483  int joinStyle, double mitreLimit);
484 
485 
486 /************************************************************************
487  *
488  * Geometry Constructors.
489  * GEOSCoordSequence* arguments will become ownership of the returned object.
490  * All functions return NULL on exception.
491  *
492  ***********************************************************************/
493 
495  GEOSContextHandle_t handle,
496  GEOSCoordSequence* s);
498  GEOSContextHandle_t handle,
499  double x,
500  double y);
502  GEOSContextHandle_t handle);
504  GEOSContextHandle_t handle,
505  GEOSCoordSequence* s);
507  GEOSContextHandle_t handle,
508  GEOSCoordSequence* s);
510  GEOSContextHandle_t handle);
511 
512 /*
513  * Second argument is an array of GEOSGeometry* objects.
514  * The caller remains owner of the array, but pointed-to
515  * objects become ownership of the returned GEOSGeometry.
516  */
518  GEOSContextHandle_t handle);
520  GEOSContextHandle_t handle,
521  GEOSGeometry* shell,
522  GEOSGeometry** holes,
523  unsigned int nholes);
525  GEOSContextHandle_t handle, int type,
526  GEOSGeometry* *geoms,
527  unsigned int ngeoms);
529  GEOSContextHandle_t handle, int type);
530 
531 extern GEOSGeometry GEOS_DLL *GEOSGeom_clone_r(GEOSContextHandle_t handle,
532  const GEOSGeometry* g);
533 
534 /************************************************************************
535  *
536  * Memory management
537  *
538  ***********************************************************************/
539 
540 extern void GEOS_DLL GEOSGeom_destroy_r(GEOSContextHandle_t handle,
541  GEOSGeometry* g);
542 
543 /************************************************************************
544  *
545  * Topology operations - return NULL on exception.
546  *
547  ***********************************************************************/
548 
549 extern GEOSGeometry GEOS_DLL *GEOSEnvelope_r(GEOSContextHandle_t handle,
550  const GEOSGeometry* g);
551 extern GEOSGeometry GEOS_DLL *GEOSIntersection_r(GEOSContextHandle_t handle,
552  const GEOSGeometry* g1,
553  const GEOSGeometry* g2);
554 extern GEOSGeometry GEOS_DLL *GEOSIntersectionPrec_r(GEOSContextHandle_t handle,
555  const GEOSGeometry* g1,
556  const GEOSGeometry* g2,
557  double gridSize);
558 extern GEOSGeometry GEOS_DLL *GEOSConvexHull_r(GEOSContextHandle_t handle,
559  const GEOSGeometry* g);
560 
561 /* Returns the minimum rotated rectangular POLYGON which encloses the input geometry. The rectangle
562  * has width equal to the minimum diameter, and a longer length. If the convex hill of the input is
563  * degenerate (a line or point) a LINESTRING or POINT is returned. The minimum rotated rectangle can
564  * be used as an extremely generalized representation for the given geometry.
565  */
566 extern GEOSGeometry GEOS_DLL *GEOSMinimumRotatedRectangle_r(GEOSContextHandle_t handle,
567  const GEOSGeometry* g);
568 
569 extern GEOSGeometry GEOS_DLL *GEOSMaximumInscribedCircle_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double tolerance);
570 extern GEOSGeometry GEOS_DLL *GEOSLargestEmptyCircle_r(GEOSContextHandle_t handle, const GEOSGeometry* g, const GEOSGeometry* boundary, double tolerance);
571 
572 /* Returns a LINESTRING geometry which represents the minimum diameter of the geometry.
573  * The minimum diameter is defined to be the width of the smallest band that
574  * contains the geometry, where a band is a strip of the plane defined
575  * by two parallel lines. This can be thought of as the smallest hole that the geometry
576  * can be moved through, with a single rotation.
577  */
578 extern GEOSGeometry GEOS_DLL *GEOSMinimumWidth_r(GEOSContextHandle_t handle,
579  const GEOSGeometry* g);
580 
581 extern GEOSGeometry GEOS_DLL *GEOSMinimumClearanceLine_r(GEOSContextHandle_t handle,
582  const GEOSGeometry* g);
583 
584 extern int GEOS_DLL GEOSMinimumClearance_r(GEOSContextHandle_t handle,
585  const GEOSGeometry* g,
586  double* distance);
587 
588 extern GEOSGeometry GEOS_DLL *GEOSDifference_r(GEOSContextHandle_t handle,
589  const GEOSGeometry* g1,
590  const GEOSGeometry* g2);
591 extern GEOSGeometry GEOS_DLL *GEOSDifferencePrec_r(GEOSContextHandle_t handle,
592  const GEOSGeometry* g1,
593  const GEOSGeometry* g2,
594  double gridSize);
595 extern GEOSGeometry GEOS_DLL *GEOSSymDifference_r(GEOSContextHandle_t handle,
596  const GEOSGeometry* g1,
597  const GEOSGeometry* g2);
598 extern GEOSGeometry GEOS_DLL *GEOSSymDifferencePrec_r(GEOSContextHandle_t handle,
599  const GEOSGeometry* g1,
600  const GEOSGeometry* g2,
601  double gridSize);
602 extern GEOSGeometry GEOS_DLL *GEOSBoundary_r(GEOSContextHandle_t handle,
603  const GEOSGeometry* g);
604 extern GEOSGeometry GEOS_DLL *GEOSUnion_r(GEOSContextHandle_t handle,
605  const GEOSGeometry* g1,
606  const GEOSGeometry* g2);
607 extern GEOSGeometry GEOS_DLL *GEOSUnionPrec_r(GEOSContextHandle_t handle,
608  const GEOSGeometry* g1,
609  const GEOSGeometry* g2,
610  double gridSize);
611 extern GEOSGeometry GEOS_DLL *GEOSUnaryUnion_r(GEOSContextHandle_t handle,
612  const GEOSGeometry* g);
613 extern GEOSGeometry GEOS_DLL *GEOSUnaryUnionPrec_r(GEOSContextHandle_t handle,
614  const GEOSGeometry* g,
615  double gridSize);
616 /* GEOSCoverageUnion is an optimized union algorithm for polygonal inputs that are correctly
617  * noded and do not overlap. It will not generate an error (return NULL) for inputs that
618  * do not satisfy this constraint. */
619 extern GEOSGeometry GEOS_DLL *GEOSCoverageUnion_r(GEOSContextHandle_t handle,
620  const GEOSGeometry* g);
621 /* @deprecated in 3.3.0: use GEOSUnaryUnion_r instead */
622 extern GEOSGeometry GEOS_DLL *GEOSUnionCascaded_r(GEOSContextHandle_t handle,
623  const GEOSGeometry* g);
624 extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface_r(GEOSContextHandle_t handle,
625  const GEOSGeometry* g);
626 extern GEOSGeometry GEOS_DLL *GEOSGetCentroid_r(GEOSContextHandle_t handle,
627  const GEOSGeometry* g);
628 extern GEOSGeometry GEOS_DLL *GEOSMinimumBoundingCircle_r(GEOSContextHandle_t handle,
629  const GEOSGeometry* g, double* radius,
630  GEOSGeometry** center);
631 extern GEOSGeometry GEOS_DLL *GEOSNode_r(GEOSContextHandle_t handle,
632  const GEOSGeometry* g);
633 /* Fast, non-robust intersection between an arbitrary geometry and
634  * a rectangle. The returned geometry may be invalid. */
635 extern GEOSGeometry GEOS_DLL *GEOSClipByRect_r(GEOSContextHandle_t handle,
636  const GEOSGeometry* g,
637  double xmin, double ymin,
638  double xmax, double ymax);
639 
640 /*
641  * all arguments remain ownership of the caller
642  * (both Geometries and pointers)
643  */
644 /*
645  * Polygonizes a set of Geometries which contain linework that
646  * represents the edges of a planar graph.
647  *
648  * All types of Geometry are accepted as input; the constituent
649  * linework is extracted as the edges to be polygonized.
650  *
651  * The edges must be correctly noded; that is, they must only meet
652  * at their endpoints. Polygonization will accept incorrectly noded
653  * input but will not form polygons from non-noded edges, and reports
654  * them as errors.
655  *
656  * The Polygonizer reports the follow kinds of errors:
657  *
658  * - Dangles - edges which have one or both ends which are
659  * not incident on another edge endpoint
660  * - Cut Edges - edges which are connected at both ends but
661  * which do not form part of a polygon
662  * - Invalid Ring Lines - edges which form rings which are invalid
663  * (e.g. the component lines contain a self-intersection)
664  *
665  * Errors are reported to output parameters "cuts", "dangles" and
666  * "invalid" (if not-null). Formed polygons are returned as a
667  * collection. NULL is returned on exception. All returned
668  * geometries must be destroyed by caller.
669  *
670  * The GEOSPolygonize_valid_r variant allows extracting only polygons
671  * which form a valid polygonal result. The set of extracted polygons
672  * is guaranteed to be edge-disjoint. This is useful when it is known
673  * that the input lines form a valid polygonal geometry (which may
674  * include holes or nested polygons).
675  */
676 
677 extern GEOSGeometry GEOS_DLL *GEOSPolygonize_r(GEOSContextHandle_t handle,
678  const GEOSGeometry *const geoms[],
679  unsigned int ngeoms);
680 extern GEOSGeometry GEOS_DLL *GEOSPolygonize_valid_r(GEOSContextHandle_t handle,
681  const GEOSGeometry *const geoms[],
682  unsigned int ngems);
684  GEOSContextHandle_t handle,
685  const GEOSGeometry * const geoms[],
686  unsigned int ngeoms);
687 extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full_r(GEOSContextHandle_t handle,
688  const GEOSGeometry* input, GEOSGeometry** cuts,
689  GEOSGeometry** dangles, GEOSGeometry** invalidRings);
690 
692  GEOSContextHandle_t handle,
693  const GEOSGeometry* g);
694 
695 extern GEOSGeometry GEOS_DLL *GEOSLineMerge_r(GEOSContextHandle_t handle,
696  const GEOSGeometry* g);
697 extern GEOSGeometry GEOS_DLL *GEOSReverse_r(GEOSContextHandle_t handle,
698  const GEOSGeometry* g);
699 extern GEOSGeometry GEOS_DLL *GEOSSimplify_r(GEOSContextHandle_t handle,
700  const GEOSGeometry* g,
701  double tolerance);
703  GEOSContextHandle_t handle,
704  const GEOSGeometry* g, double tolerance);
705 
706 /*
707  * Return all distinct vertices of input geometry as a MULTIPOINT.
708  * Note that only 2 dimensions of the vertices are considered when
709  * testing for equality.
710  */
712  GEOSContextHandle_t handle,
713  const GEOSGeometry* g);
714 
715 /*
716  * Find paths shared between the two given lineal geometries.
717  *
718  * Returns a GEOMETRYCOLLECTION having two elements:
719  * - first element is a MULTILINESTRING containing shared paths
720  * having the _same_ direction on both inputs
721  * - second element is a MULTILINESTRING containing shared paths
722  * having the _opposite_ direction on the two inputs
723  *
724  * Returns NULL on exception
725  */
726 extern GEOSGeometry GEOS_DLL *GEOSSharedPaths_r(GEOSContextHandle_t handle,
727  const GEOSGeometry* g1, const GEOSGeometry* g2);
728 
729 /*
730  * Snap first geometry on to second with given tolerance
731  * Returns a newly allocated geometry, or NULL on exception
732  */
733 extern GEOSGeometry GEOS_DLL *GEOSSnap_r(GEOSContextHandle_t handle,
734  const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance);
735 
736 /*
737  * Return a Delaunay triangulation of the vertex of the given geometry
738  *
739  * @param g the input geometry whose vertex will be used as "sites"
740  * @param tolerance optional snapping tolerance to use for improved robustness
741  * @param onlyEdges if non-zero will return a MULTILINESTRING, otherwise it will
742  * return a GEOMETRYCOLLECTION containing triangular POLYGONs.
743  *
744  * @return a newly allocated geometry, or NULL on exception
745  */
747  GEOSContextHandle_t handle,
748  const GEOSGeometry *g,
749  double tolerance,
750  int onlyEdges);
751 
752 /*
753  * Returns the Voronoi polygons of a set of Vertices given as input
754  *
755  * @param g the input geometry whose vertex will be used as sites.
756  * @param tolerance snapping tolerance to use for improved robustness
757  * @param onlyEdges whether to return only edges of the Voronoi cells
758  * @param env clipping envelope for the returned diagram, automatically
759  * determined if NULL.
760  * The diagram will be clipped to the larger
761  * of this envelope or an envelope surrounding the sites.
762  *
763  * @return a newly allocated geometry, or NULL on exception.
764  */
766  GEOSContextHandle_t extHandle,
767  const GEOSGeometry *g,
768  const GEOSGeometry *env,
769  double tolerance,
770  int onlyEdges);
771 
772 /*
773  * Computes the coordinate where two line segments intersect, if any
774  *
775  * @param ax0 x-coordinate of first point in first segment
776  * @param ay0 y-coordinate of first point in first segment
777  * @param ax1 x-coordinate of second point in first segment
778  * @param ay1 y-coordinate of second point in first segment
779  * @param bx0 x-coordinate of first point in second segment
780  * @param by0 y-coordinate of first point in second segment
781  * @param bx1 x-coordinate of second point in second segment
782  * @param by1 y-coordinate of second point in second segment
783  * @param cx x-coordinate of intersection point
784  * @param cy y-coordinate of intersection point
785  *
786  * @return 0 on error, 1 on success, -1 if segments do not intersect
787  */
788 
790  GEOSContextHandle_t extHandle,
791  double ax0, double ay0,
792  double ax1, double ay1,
793  double bx0, double by0,
794  double bx1, double by1,
795  double* cx, double* cy);
796 
797 /************************************************************************
798  *
799  * Binary predicates - return 2 on exception, 1 on true, 0 on false
800  *
801  ***********************************************************************/
802 
803 extern char GEOS_DLL GEOSDisjoint_r(GEOSContextHandle_t handle,
804  const GEOSGeometry* g1,
805  const GEOSGeometry* g2);
806 extern char GEOS_DLL GEOSTouches_r(GEOSContextHandle_t handle,
807  const GEOSGeometry* g1,
808  const GEOSGeometry* g2);
809 extern char GEOS_DLL GEOSIntersects_r(GEOSContextHandle_t handle,
810  const GEOSGeometry* g1,
811  const GEOSGeometry* g2);
812 extern char GEOS_DLL GEOSCrosses_r(GEOSContextHandle_t handle,
813  const GEOSGeometry* g1,
814  const GEOSGeometry* g2);
815 extern char GEOS_DLL GEOSWithin_r(GEOSContextHandle_t handle,
816  const GEOSGeometry* g1,
817  const GEOSGeometry* g2);
818 extern char GEOS_DLL GEOSContains_r(GEOSContextHandle_t handle,
819  const GEOSGeometry* g1,
820  const GEOSGeometry* g2);
821 extern char GEOS_DLL GEOSOverlaps_r(GEOSContextHandle_t handle,
822  const GEOSGeometry* g1,
823  const GEOSGeometry* g2);
824 extern char GEOS_DLL GEOSEquals_r(GEOSContextHandle_t handle,
825  const GEOSGeometry* g1,
826  const GEOSGeometry* g2);
827 extern char GEOS_DLL GEOSEqualsExact_r(GEOSContextHandle_t handle,
828  const GEOSGeometry* g1,
829  const GEOSGeometry* g2,
830  double tolerance);
831 extern char GEOS_DLL GEOSCovers_r(GEOSContextHandle_t handle,
832  const GEOSGeometry* g1,
833  const GEOSGeometry* g2);
834 extern char GEOS_DLL GEOSCoveredBy_r(GEOSContextHandle_t handle,
835  const GEOSGeometry* g1,
836  const GEOSGeometry* g2);
837 
838 /************************************************************************
839  *
840  * Prepared Geometry Binary predicates - return 2 on exception, 1 on true, 0 on false
841  *
842  ***********************************************************************/
843 
844 /*
845  * GEOSGeometry ownership is retained by caller
846  */
848  GEOSContextHandle_t handle,
849  const GEOSGeometry* g);
850 
851 extern void GEOS_DLL GEOSPreparedGeom_destroy_r(GEOSContextHandle_t handle,
852  const GEOSPreparedGeometry* g);
853 
854 extern char GEOS_DLL GEOSPreparedContains_r(GEOSContextHandle_t handle,
855  const GEOSPreparedGeometry* pg1,
856  const GEOSGeometry* g2);
857 extern char GEOS_DLL GEOSPreparedContainsProperly_r(GEOSContextHandle_t handle,
858  const GEOSPreparedGeometry* pg1,
859  const GEOSGeometry* g2);
860 extern char GEOS_DLL GEOSPreparedCoveredBy_r(GEOSContextHandle_t handle,
861  const GEOSPreparedGeometry* pg1,
862  const GEOSGeometry* g2);
863 extern char GEOS_DLL GEOSPreparedCovers_r(GEOSContextHandle_t handle,
864  const GEOSPreparedGeometry* pg1,
865  const GEOSGeometry* g2);
866 extern char GEOS_DLL GEOSPreparedCrosses_r(GEOSContextHandle_t handle,
867  const GEOSPreparedGeometry* pg1,
868  const GEOSGeometry* g2);
869 extern char GEOS_DLL GEOSPreparedDisjoint_r(GEOSContextHandle_t handle,
870  const GEOSPreparedGeometry* pg1,
871  const GEOSGeometry* g2);
872 extern char GEOS_DLL GEOSPreparedIntersects_r(GEOSContextHandle_t handle,
873  const GEOSPreparedGeometry* pg1,
874  const GEOSGeometry* g2);
875 extern char GEOS_DLL GEOSPreparedOverlaps_r(GEOSContextHandle_t handle,
876  const GEOSPreparedGeometry* pg1,
877  const GEOSGeometry* g2);
878 extern char GEOS_DLL GEOSPreparedTouches_r(GEOSContextHandle_t handle,
879  const GEOSPreparedGeometry* pg1,
880  const GEOSGeometry* g2);
881 extern char GEOS_DLL GEOSPreparedWithin_r(GEOSContextHandle_t handle,
882  const GEOSPreparedGeometry* pg1,
883  const GEOSGeometry* g2);
884 
885 /* Return 0 on exception, the closest points of the two geometries otherwise.
886  * The first point comes from pg1 geometry and the second point comes from g2.
887  */
889  GEOSContextHandle_t handle,
890  const GEOSPreparedGeometry* pg1,
891  const GEOSGeometry* g2);
892 
894  GEOSContextHandle_t handle,
895  const GEOSPreparedGeometry* pg1,
896  const GEOSGeometry* g2, double *dist);
897 
898 /************************************************************************
899  *
900  * STRtree functions
901  *
902  ***********************************************************************/
903 
904 /*
905  * GEOSGeometry ownership is retained by caller
906  */
907 
909  GEOSContextHandle_t handle,
910  size_t nodeCapacity);
911 extern void GEOS_DLL GEOSSTRtree_insert_r(GEOSContextHandle_t handle,
912  GEOSSTRtree *tree,
913  const GEOSGeometry *g,
914  void *item);
915 extern void GEOS_DLL GEOSSTRtree_query_r(GEOSContextHandle_t handle,
916  GEOSSTRtree *tree,
917  const GEOSGeometry *g,
918  GEOSQueryCallback callback,
919  void *userdata);
920 
921 extern const GEOSGeometry GEOS_DLL *GEOSSTRtree_nearest_r(GEOSContextHandle_t handle,
922  GEOSSTRtree *tree,
923  const GEOSGeometry* geom);
924 
925 
926 extern const void GEOS_DLL *GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t handle,
927  GEOSSTRtree *tree,
928  const void* item,
929  const GEOSGeometry* itemEnvelope,
930  GEOSDistanceCallback distancefn,
931  void* userdata);
932 
933 extern void GEOS_DLL GEOSSTRtree_iterate_r(GEOSContextHandle_t handle,
934  GEOSSTRtree *tree,
935  GEOSQueryCallback callback,
936  void *userdata);
937 extern char GEOS_DLL GEOSSTRtree_remove_r(GEOSContextHandle_t handle,
938  GEOSSTRtree *tree,
939  const GEOSGeometry *g,
940  void *item);
941 extern void GEOS_DLL GEOSSTRtree_destroy_r(GEOSContextHandle_t handle,
942  GEOSSTRtree *tree);
943 
944 
945 /************************************************************************
946  *
947  * Unary predicate - return 2 on exception, 1 on true, 0 on false
948  *
949  ***********************************************************************/
950 
951 extern char GEOS_DLL GEOSisEmpty_r(GEOSContextHandle_t handle,
952  const GEOSGeometry* g);
953 extern char GEOS_DLL GEOSisSimple_r(GEOSContextHandle_t handle,
954  const GEOSGeometry* g);
955 extern char GEOS_DLL GEOSisRing_r(GEOSContextHandle_t handle,
956  const GEOSGeometry* g);
957 extern char GEOS_DLL GEOSHasZ_r(GEOSContextHandle_t handle,
958  const GEOSGeometry* g);
959 extern char GEOS_DLL GEOSisClosed_r(GEOSContextHandle_t handle,
960  const GEOSGeometry *g);
961 
962 /************************************************************************
963  *
964  * Dimensionally Extended 9 Intersection Model related
965  *
966  ***********************************************************************/
967 
968 /* These are for use with GEOSRelateBoundaryNodeRule (flags param) */
970  /* MOD2 and OGC are the same rule, and is the default
971  * used by GEOSRelatePattern
972  */
978 };
979 
980 /* return 2 on exception, 1 on true, 0 on false */
981 extern char GEOS_DLL GEOSRelatePattern_r(GEOSContextHandle_t handle,
982  const GEOSGeometry* g1,
983  const GEOSGeometry* g2,
984  const char *pat);
985 
986 /* return NULL on exception, a string to GEOSFree otherwise */
987 extern char GEOS_DLL *GEOSRelate_r(GEOSContextHandle_t handle,
988  const GEOSGeometry* g1,
989  const GEOSGeometry* g2);
990 
991 /* return 2 on exception, 1 on true, 0 on false */
992 extern char GEOS_DLL GEOSRelatePatternMatch_r(GEOSContextHandle_t handle,
993  const char *mat,
994  const char *pat);
995 
996 /* return NULL on exception, a string to GEOSFree otherwise */
997 extern char GEOS_DLL *GEOSRelateBoundaryNodeRule_r(GEOSContextHandle_t handle,
998  const GEOSGeometry* g1,
999  const GEOSGeometry* g2,
1000  int bnr);
1001 
1002 /************************************************************************
1003  *
1004  * Validity checking
1005  *
1006  ***********************************************************************/
1007 
1008 /* These are for use with GEOSisValidDetail (flags param) */
1011 };
1012 
1013 /* return 2 on exception, 1 on true, 0 on false */
1014 extern char GEOS_DLL GEOSisValid_r(GEOSContextHandle_t handle,
1015  const GEOSGeometry* g);
1016 
1017 /* return NULL on exception, a string to GEOSFree otherwise */
1018 extern char GEOS_DLL *GEOSisValidReason_r(GEOSContextHandle_t handle,
1019  const GEOSGeometry* g);
1020 
1021 /*
1022  * Caller has the responsibility to destroy 'reason' (GEOSFree)
1023  * and 'location' (GEOSGeom_destroy) params
1024  * return 2 on exception, 1 when valid, 0 when invalid
1025  */
1026 extern char GEOS_DLL GEOSisValidDetail_r(GEOSContextHandle_t handle,
1027  const GEOSGeometry* g,
1028  int flags,
1029  char** reason,
1030  GEOSGeometry** location);
1031 
1032 extern GEOSGeometry GEOS_DLL *GEOSMakeValid_r(GEOSContextHandle_t handle,
1033  const GEOSGeometry* g);
1034 
1035 /************************************************************************
1036  *
1037  * Geometry info
1038  *
1039  ***********************************************************************/
1040 
1041 /* Return NULL on exception, result must be freed by caller. */
1042 extern char GEOS_DLL *GEOSGeomType_r(GEOSContextHandle_t handle,
1043  const GEOSGeometry* g);
1044 
1045 /* Return -1 on exception */
1046 extern int GEOS_DLL GEOSGeomTypeId_r(GEOSContextHandle_t handle,
1047  const GEOSGeometry* g);
1048 
1049 /* Return 0 on exception */
1050 extern int GEOS_DLL GEOSGetSRID_r(GEOSContextHandle_t handle,
1051  const GEOSGeometry* g);
1052 
1053 extern void GEOS_DLL GEOSSetSRID_r(GEOSContextHandle_t handle,
1054  GEOSGeometry* g, int SRID);
1055 
1056 extern void GEOS_DLL *GEOSGeom_getUserData_r(GEOSContextHandle_t handle,
1057 const GEOSGeometry* g);
1058 
1059 extern void GEOS_DLL GEOSGeom_setUserData_r(GEOSContextHandle_t handle,
1060  GEOSGeometry* g, void* userData);
1061 
1062 /* May be called on all geometries in GEOS 3.x, returns -1 on error and 1
1063  * for non-multi geometries. Older GEOS versions only accept
1064  * GeometryCollections or Multi* geometries here, and are likely to crash
1065  * when fed simple geometries, so beware if you need compatibility with
1066  * old GEOS versions.
1067  */
1068 extern int GEOS_DLL GEOSGetNumGeometries_r(GEOSContextHandle_t handle,
1069  const GEOSGeometry* g);
1070 
1071 /*
1072  * Return NULL on exception.
1073  * Returned object is a pointer to internal storage:
1074  * it must NOT be destroyed directly.
1075  * Up to GEOS 3.2.0 the input geometry must be a Collection, in
1076  * later version it doesn't matter (getGeometryN(0) for a single will
1077  * return the input).
1078  */
1080  GEOSContextHandle_t handle,
1081  const GEOSGeometry* g, int n);
1082 
1083 /* Return -1 on exception */
1084 extern int GEOS_DLL GEOSNormalize_r(GEOSContextHandle_t handle,
1085  GEOSGeometry* g);
1086 
1089 #define GEOS_PREC_NO_TOPO (1<<0)
1090 
1093 #define GEOS_PREC_KEEP_COLLAPSED (1<<1)
1094 
1111  GEOSContextHandle_t handle,
1112  const GEOSGeometry *g,
1113  double gridSize, int flags);
1114 
1121 extern double GEOS_DLL GEOSGeom_getPrecision_r(
1122  GEOSContextHandle_t handle,
1123  const GEOSGeometry *g);
1124 
1125 /* Return -1 on exception */
1126 extern int GEOS_DLL GEOSGetNumInteriorRings_r(GEOSContextHandle_t handle,
1127  const GEOSGeometry* g);
1128 
1129 /* Return -1 on exception, Geometry must be a LineString. */
1130 extern int GEOS_DLL GEOSGeomGetNumPoints_r(GEOSContextHandle_t handle,
1131  const GEOSGeometry* g);
1132 
1133 /* Return 0 on exception, otherwise 1, Geometry must be a Point. */
1134 extern int GEOS_DLL GEOSGeomGetX_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *x);
1135 extern int GEOS_DLL GEOSGeomGetY_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *y);
1136 extern int GEOS_DLL GEOSGeomGetZ_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *z);
1137 
1138 /*
1139  * Return NULL on exception, Geometry must be a Polygon.
1140  * Returned object is a pointer to internal storage:
1141  * it must NOT be destroyed directly.
1142  */
1144  GEOSContextHandle_t handle,
1145  const GEOSGeometry* g, int n);
1146 
1147 /*
1148  * Return NULL on exception, Geometry must be a Polygon.
1149  * Returned object is a pointer to internal storage:
1150  * it must NOT be destroyed directly.
1151  */
1153  GEOSContextHandle_t handle,
1154  const GEOSGeometry* g);
1155 
1156 /* Return -1 on exception */
1157 extern int GEOS_DLL GEOSGetNumCoordinates_r(GEOSContextHandle_t handle,
1158  const GEOSGeometry* g);
1159 
1160 /*
1161  * Return NULL on exception.
1162  * Geometry must be a LineString, LinearRing or Point.
1163  */
1165  GEOSContextHandle_t handle,
1166  const GEOSGeometry* g);
1167 
1168 /*
1169  * Return 0 on exception (or empty geometry)
1170  */
1171 extern int GEOS_DLL GEOSGeom_getDimensions_r(GEOSContextHandle_t handle,
1172  const GEOSGeometry* g);
1173 
1174 /*
1175  * Return 2 or 3.
1176  */
1177 extern int GEOS_DLL GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t handle,
1178  const GEOSGeometry* g);
1179 /*
1180  * Return 0 on exception
1181  */
1182 extern int GEOS_DLL GEOSGeom_getXMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
1183 extern int GEOS_DLL GEOSGeom_getYMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
1184 extern int GEOS_DLL GEOSGeom_getXMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
1185 extern int GEOS_DLL GEOSGeom_getYMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
1186 
1187 /*
1188  * Return NULL on exception.
1189  * Must be LineString and must be freed by called.
1190  */
1191 extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN_r(GEOSContextHandle_t handle, const GEOSGeometry *g, int n);
1192 extern GEOSGeometry GEOS_DLL *GEOSGeomGetStartPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g);
1193 extern GEOSGeometry GEOS_DLL *GEOSGeomGetEndPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g);
1194 
1195 /************************************************************************
1196  *
1197  * Misc functions
1198  *
1199  ***********************************************************************/
1200 
1201 /* Return 0 on exception, 1 otherwise */
1202 extern int GEOS_DLL GEOSArea_r(GEOSContextHandle_t handle,
1203  const GEOSGeometry* g, double *area);
1204 extern int GEOS_DLL GEOSLength_r(GEOSContextHandle_t handle,
1205  const GEOSGeometry* g, double *length);
1206 extern int GEOS_DLL GEOSDistance_r(GEOSContextHandle_t handle,
1207  const GEOSGeometry* g1,
1208  const GEOSGeometry* g2, double *dist);
1209 extern int GEOS_DLL GEOSDistanceIndexed_r(GEOSContextHandle_t handle,
1210  const GEOSGeometry* g1,
1211  const GEOSGeometry* g2, double *dist);
1212 extern int GEOS_DLL GEOSHausdorffDistance_r(GEOSContextHandle_t handle,
1213  const GEOSGeometry *g1,
1214  const GEOSGeometry *g2,
1215  double *dist);
1216 extern int GEOS_DLL GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t handle,
1217  const GEOSGeometry *g1,
1218  const GEOSGeometry *g2,
1219  double densifyFrac, double *dist);
1220 extern int GEOS_DLL GEOSFrechetDistance_r(GEOSContextHandle_t handle,
1221  const GEOSGeometry *g1,
1222  const GEOSGeometry *g2,
1223  double *dist);
1224 extern int GEOS_DLL GEOSFrechetDistanceDensify_r(GEOSContextHandle_t handle,
1225  const GEOSGeometry *g1,
1226  const GEOSGeometry *g2,
1227  double densifyFrac, double *dist);
1228 extern int GEOS_DLL GEOSGeomGetLength_r(GEOSContextHandle_t handle,
1229  const GEOSGeometry *g, double *length);
1230 
1231 /* Return 0 on exception, the closest points of the two geometries otherwise.
1232  * The first point comes from g1 geometry and the second point comes from g2.
1233  */
1235  GEOSContextHandle_t handle, const GEOSGeometry* g1, const GEOSGeometry* g2);
1236 
1237 
1238 /************************************************************************
1239  *
1240  * Algorithms
1241  *
1242  ***********************************************************************/
1243 
1244 /* Walking from A to B:
1245  * return -1 if reaching P takes a counter-clockwise (left) turn
1246  * return 1 if reaching P takes a clockwise (right) turn
1247  * return 0 if P is collinear with A-B
1248  *
1249  * On exceptions, return 2.
1250  *
1251  */
1252 extern int GEOS_DLL GEOSOrientationIndex_r(GEOSContextHandle_t handle,
1253  double Ax, double Ay, double Bx, double By, double Px, double Py);
1254 
1255 
1256 /************************************************************************
1257  *
1258  * Reader and Writer APIs
1259  *
1260  ***********************************************************************/
1261 
1262 #ifndef GEOSWKTReader
1263 typedef struct GEOSWKTReader_t GEOSWKTReader;
1264 typedef struct GEOSWKTWriter_t GEOSWKTWriter;
1265 typedef struct GEOSWKBReader_t GEOSWKBReader;
1266 typedef struct GEOSWKBWriter_t GEOSWKBWriter;
1267 #endif
1268 
1269 /* WKT Reader */
1271  GEOSContextHandle_t handle);
1272 extern void GEOS_DLL GEOSWKTReader_destroy_r(GEOSContextHandle_t handle,
1273  GEOSWKTReader* reader);
1274 extern GEOSGeometry GEOS_DLL *GEOSWKTReader_read_r(GEOSContextHandle_t handle,
1275  GEOSWKTReader* reader,
1276  const char *wkt);
1277 
1278 /* WKT Writer */
1280  GEOSContextHandle_t handle);
1281 extern void GEOS_DLL GEOSWKTWriter_destroy_r(GEOSContextHandle_t handle,
1282  GEOSWKTWriter* writer);
1283 extern char GEOS_DLL *GEOSWKTWriter_write_r(GEOSContextHandle_t handle,
1284  GEOSWKTWriter* writer,
1285  const GEOSGeometry* g);
1286 extern void GEOS_DLL GEOSWKTWriter_setTrim_r(GEOSContextHandle_t handle,
1287  GEOSWKTWriter *writer,
1288  char trim);
1289 extern void GEOS_DLL GEOSWKTWriter_setRoundingPrecision_r(GEOSContextHandle_t handle,
1290  GEOSWKTWriter *writer,
1291  int precision);
1292 extern void GEOS_DLL GEOSWKTWriter_setOutputDimension_r(GEOSContextHandle_t handle,
1293  GEOSWKTWriter *writer,
1294  int dim);
1295 extern int GEOS_DLL GEOSWKTWriter_getOutputDimension_r(GEOSContextHandle_t handle,
1296  GEOSWKTWriter *writer);
1297 extern void GEOS_DLL GEOSWKTWriter_setOld3D_r(GEOSContextHandle_t handle,
1298  GEOSWKTWriter *writer,
1299  int useOld3D);
1300 
1301 /* WKB Reader */
1303  GEOSContextHandle_t handle);
1304 extern void GEOS_DLL GEOSWKBReader_destroy_r(GEOSContextHandle_t handle,
1305  GEOSWKBReader* reader);
1306 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_read_r(GEOSContextHandle_t handle,
1307  GEOSWKBReader* reader,
1308  const unsigned char *wkb,
1309  size_t size);
1311  GEOSContextHandle_t handle,
1312  GEOSWKBReader* reader,
1313  const unsigned char *hex,
1314  size_t size);
1315 
1316 /* WKB Writer */
1318  GEOSContextHandle_t handle);
1319 extern void GEOS_DLL GEOSWKBWriter_destroy_r(GEOSContextHandle_t handle,
1320  GEOSWKBWriter* writer);
1321 
1322 /* The caller owns the results for these two methods! */
1323 extern unsigned char GEOS_DLL *GEOSWKBWriter_write_r(
1324  GEOSContextHandle_t handle,
1325  GEOSWKBWriter* writer,
1326  const GEOSGeometry* g,
1327  size_t *size);
1328 extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX_r(
1329  GEOSContextHandle_t handle,
1330  GEOSWKBWriter* writer,
1331  const GEOSGeometry* g,
1332  size_t *size);
1333 
1334 /*
1335  * Specify whether output WKB should be 2d or 3d.
1336  * Return previously set number of dimensions.
1337  */
1339  GEOSContextHandle_t handle,
1340  const GEOSWKBWriter* writer);
1342  GEOSContextHandle_t handle,
1343  GEOSWKBWriter* writer, int newDimension);
1344 
1345 /*
1346  * Specify whether the WKB byte order is big or little endian.
1347  * The return value is the previous byte order.
1348  */
1349 extern int GEOS_DLL GEOSWKBWriter_getByteOrder_r(GEOSContextHandle_t handle,
1350  const GEOSWKBWriter* writer);
1351 extern void GEOS_DLL GEOSWKBWriter_setByteOrder_r(GEOSContextHandle_t handle,
1352  GEOSWKBWriter* writer,
1353  int byteOrder);
1354 
1355 /*
1356  * Specify whether SRID values should be output.
1357  */
1358 extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID_r(GEOSContextHandle_t handle,
1359  const GEOSWKBWriter* writer);
1360 extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID_r(GEOSContextHandle_t handle,
1361  GEOSWKBWriter* writer, const char writeSRID);
1362 
1363 
1364 /*
1365  * Free buffers returned by stuff like GEOSWKBWriter_write(),
1366  * GEOSWKBWriter_writeHEX() and GEOSWKTWriter_write().
1367  */
1368 extern void GEOS_DLL GEOSFree_r(GEOSContextHandle_t handle, void *buffer);
1369 
1370 
1371 /* External code to GEOS can define GEOS_USE_ONLY_R_API to avoid the */
1372 /* non _r API to be available */
1373 #ifndef GEOS_USE_ONLY_R_API
1374 
1375 /************************************************************************
1376  *
1377  * Initialization, cleanup, version
1378  *
1379  ***********************************************************************/
1380 
1381 extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function,
1382  GEOSMessageHandler error_function);
1383 extern void GEOS_DLL finishGEOS(void);
1384 
1385 /************************************************************************
1386  *
1387  * NOTE - These functions are DEPRECATED. Please use the new Reader and
1388  * writer APIS!
1389  *
1390  ***********************************************************************/
1391 
1392 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKT(const char *wkt);
1393 extern char GEOS_DLL *GEOSGeomToWKT(const GEOSGeometry* g);
1394 
1395 /*
1396  * Specify whether output WKB should be 2d or 3d.
1397  * Return previously set number of dimensions.
1398  */
1399 extern int GEOS_DLL GEOS_getWKBOutputDims();
1400 extern int GEOS_DLL GEOS_setWKBOutputDims(int newDims);
1401 
1402 /*
1403  * Specify whether the WKB byte order is big or little endian.
1404  * The return value is the previous byte order.
1405  */
1406 extern int GEOS_DLL GEOS_getWKBByteOrder();
1407 extern int GEOS_DLL GEOS_setWKBByteOrder(int byteOrder);
1408 
1409 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKB_buf(const unsigned char *wkb, size_t size);
1410 extern unsigned char GEOS_DLL *GEOSGeomToWKB_buf(const GEOSGeometry* g, size_t *size);
1411 
1412 extern GEOSGeometry GEOS_DLL *GEOSGeomFromHEX_buf(const unsigned char *hex, size_t size);
1413 extern unsigned char GEOS_DLL *GEOSGeomToHEX_buf(const GEOSGeometry* g, size_t *size);
1414 
1415 /************************************************************************
1416  *
1417  * Coordinate Sequence functions
1418  *
1419  ***********************************************************************/
1420 
1421 /*
1422  * Create a Coordinate sequence with ``size'' coordinates
1423  * of ``dims'' dimensions.
1424  * Return NULL on exception.
1425  */
1426 extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_create(unsigned int size, unsigned int dims);
1427 
1428 /*
1429  * Clone a Coordinate Sequence.
1430  * Return NULL on exception.
1431  */
1433 
1434 /*
1435  * Destroy a Coordinate Sequence.
1436  */
1438 
1439 /*
1440  * Set ordinate values in a Coordinate Sequence.
1441  * Return 0 on exception.
1442  */
1444  unsigned int idx, double val);
1446  unsigned int idx, double val);
1448  unsigned int idx, double val);
1450  unsigned int idx, double x, double y);
1452  unsigned int idx, double x, double y, double z);
1454  unsigned int idx, unsigned int dim, double val);
1455 
1456 /*
1457  * Get ordinate values from a Coordinate Sequence.
1458  * Return 0 on exception.
1459  */
1460 extern int GEOS_DLL GEOSCoordSeq_getX(const GEOSCoordSequence* s,
1461  unsigned int idx, double *val);
1462 extern int GEOS_DLL GEOSCoordSeq_getY(const GEOSCoordSequence* s,
1463  unsigned int idx, double *val);
1464 extern int GEOS_DLL GEOSCoordSeq_getZ(const GEOSCoordSequence* s,
1465  unsigned int idx, double *val);
1466 extern int GEOS_DLL GEOSCoordSeq_getXY(const GEOSCoordSequence* s,
1467  unsigned int idx, double *x, double *y);
1468 extern int GEOS_DLL GEOSCoordSeq_getXYZ(const GEOSCoordSequence* s,
1469  unsigned int idx, double *x, double *y, double *z);
1471  unsigned int idx, unsigned int dim, double *val);
1472 /*
1473  * Get size and dimensions info from a Coordinate Sequence.
1474  * Return 0 on exception.
1475  */
1476 extern int GEOS_DLL GEOSCoordSeq_getSize(const GEOSCoordSequence* s,
1477  unsigned int *size);
1479  unsigned int *dims);
1480 
1481 /*
1482  * Check orientation of a CoordinateSequence and set 'is_ccw' to 1
1483  * if it has counter-clockwise orientation, 0 otherwise.
1484  * Return 0 on exception, 1 on success.
1485  */
1486 extern int GEOS_DLL GEOSCoordSeq_isCCW(const GEOSCoordSequence* s, char* is_ccw);
1487 
1488 /************************************************************************
1489  *
1490  * Linear referencing functions -- there are more, but these are
1491  * probably sufficient for most purposes
1492  *
1493  ***********************************************************************/
1494 
1495 /*
1496  * GEOSGeometry ownership is retained by caller
1497  */
1498 
1499 
1500 /* Return distance of point 'p' projected on 'g' from origin
1501  * of 'g'. Geometry 'g' must be a lineal geometry.
1502  * Return -1 on exception */
1503 extern double GEOS_DLL GEOSProject(const GEOSGeometry *g,
1504  const GEOSGeometry* p);
1505 
1506 /* Return closest point to given distance within geometry
1507  * Geometry must be a LineString */
1509  double d);
1510 
1511 extern double GEOS_DLL GEOSProjectNormalized(const GEOSGeometry *g,
1512  const GEOSGeometry* p);
1513 
1515  double d);
1516 
1517 /************************************************************************
1518  *
1519  * Buffer related functions
1520  *
1521  ***********************************************************************/
1522 
1523 
1524 /* @return NULL on exception */
1525 extern GEOSGeometry GEOS_DLL *GEOSBuffer(const GEOSGeometry* g,
1526  double width, int quadsegs);
1527 
1528 /* @return 0 on exception */
1531 
1532 /* @return 0 on exception */
1534  GEOSBufferParams* p,
1535  int style);
1536 
1537 /* @return 0 on exception */
1539  GEOSBufferParams* p,
1540  int joinStyle);
1541 
1542 /* @return 0 on exception */
1544  GEOSBufferParams* p,
1545  double mitreLimit);
1546 
1547 /* @return 0 on exception */
1549  GEOSBufferParams* p,
1550  int quadSegs);
1551 
1552 /* @param singleSided: 1 for single sided, 0 otherwise */
1553 /* @return 0 on exception */
1555  GEOSBufferParams* p,
1556  int singleSided);
1557 
1558 /* @return NULL on exception */
1560  const GEOSGeometry* g,
1561  const GEOSBufferParams* p,
1562  double width);
1563 
1564 /* These functions return NULL on exception. */
1566  double width, int quadsegs, int endCapStyle, int joinStyle,
1567  double mitreLimit);
1568 
1569 /* These functions return NULL on exception. Only LINESTRINGs are accepted. */
1570 /* @deprecated in 3.3.0: use GEOSOffsetCurve instead */
1572  double width, int quadsegs, int joinStyle, double mitreLimit,
1573  int leftSide);
1574 
1575 /*
1576  * Only LINESTRINGs are accepted.
1577  * @param width : offset distance.
1578  * negative for right side offset.
1579  * positive for left side offset.
1580  * @return NULL on exception
1581  */
1583  double width, int quadsegs, int joinStyle, double mitreLimit);
1584 
1585 /************************************************************************
1586  *
1587  * Geometry Constructors.
1588  * GEOSCoordSequence* arguments will become ownership of the returned object.
1589  * All functions return NULL on exception.
1590  *
1591  ***********************************************************************/
1592 
1594 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPointFromXY(double x, double y);
1599 
1600 /*
1601  * Second argument is an array of GEOSGeometry* objects.
1602  * The caller remains owner of the array, but pointed-to
1603  * objects become ownership of the returned GEOSGeometry.
1604  */
1607  GEOSGeometry** holes, unsigned int nholes);
1609  GEOSGeometry* *geoms, unsigned int ngeoms);
1611 
1613 
1614 /************************************************************************
1615  *
1616  * Memory management
1617  *
1618  ***********************************************************************/
1619 
1620 extern void GEOS_DLL GEOSGeom_destroy(GEOSGeometry* g);
1621 
1622 /************************************************************************
1623  *
1624  * Topology operations - return NULL on exception.
1625  *
1626  ***********************************************************************/
1627 
1629 extern GEOSGeometry GEOS_DLL *GEOSIntersection(const GEOSGeometry* g1, const GEOSGeometry* g2);
1630 extern GEOSGeometry GEOS_DLL *GEOSIntersectionPrec(const GEOSGeometry* g1, const GEOSGeometry* g2, double gridSize);
1632 
1633 /* Returns the minimum rotated rectangular POLYGON which encloses the input geometry. The rectangle
1634  * has width equal to the minimum diameter, and a longer length. If the convex hill of the input is
1635  * degenerate (a line or point) a LINESTRING or POINT is returned. The minimum rotated rectangle can
1636  * be used as an extremely generalized representation for the given geometry.
1637  */
1639 
1640 /* Constructs the Maximum Inscribed Circle for a polygonal geometry, up to a specified tolerance.
1641  * The Maximum Inscribed Circle is determined by a point in the interior of the area
1642  * which has the farthest distance from the area boundary, along with a boundary point at that distance.
1643  * In the context of geography the center of the Maximum Inscribed Circle is known as the
1644  * Pole of Inaccessibility. A cartographic use case is to determine a suitable point
1645  * to place a map label within a polygon.
1646  * The radius length of the Maximum Inscribed Circle is a measure of how "narrow" a polygon is. It is the
1647  * distance at which the negative buffer becomes empty.
1648  * The class supports polygons with holes and multipolygons.
1649  * The implementation uses a successive-approximation technique over a grid of square cells covering the area geometry.
1650  * The grid is refined using a branch-and-bound algorithm. Point containment and distance are computed in a performant
1651  * way by using spatial indexes.
1652  * Returns a two-point linestring, with one point at the center of the inscribed circle and the other
1653  * on the boundary of the inscribed circle.
1654 */
1655 extern GEOSGeometry GEOS_DLL *GEOSMaximumInscribedCircle(const GEOSGeometry* g, double tolerance);
1656 
1657 /* Constructs the Largest Empty Circle for a set of obstacle geometries, up to a
1658  * specified tolerance. The obstacles are point and line geometries.
1659  * The Largest Empty Circle is the largest circle which has its center in the convex hull of the
1660  * obstacles (the boundary), and whose interior does not intersect with any obstacle.
1661  * The circle center is the point in the interior of the boundary which has the farthest distance from
1662  * the obstacles (up to tolerance). The circle is determined by the center point and a point lying on an
1663  * obstacle indicating the circle radius.
1664  * The implementation uses a successive-approximation technique over a grid of square cells covering the obstacles and boundary.
1665  * The grid is refined using a branch-and-bound algorithm. Point containment and distance are computed in a performant
1666  * way by using spatial indexes.
1667  * Returns a two-point linestring, with one point at the center of the inscribed circle and the other
1668  * on the boundary of the inscribed circle.
1669  */
1670 extern GEOSGeometry GEOS_DLL *GEOSLargestEmptyCircle(const GEOSGeometry* g, const GEOSGeometry* boundary, double tolerance);
1671 
1672 /* Returns a LINESTRING geometry which represents the minimum diameter of the geometry.
1673  * The minimum diameter is defined to be the width of the smallest band that
1674  * contains the geometry, where a band is a strip of the plane defined
1675  * by two parallel lines. This can be thought of as the smallest hole that the geometry
1676  * can be moved through, with a single rotation.
1677  */
1679 
1680 /* Computes the minimum clearance of a geometry. The minimum clearance is the smallest amount by which
1681  * a vertex could be move to produce an invalid polygon, a non-simple linestring, or a multipoint with
1682  * repeated points. If a geometry has a minimum clearance of 'eps', it can be said that:
1683  *
1684  * - No two distinct vertices in the geometry are separated by less than 'eps'
1685  * - No vertex is closer than 'eps' to a line segment of which it is not an endpoint.
1686  *
1687  * If the minimum clearance cannot be defined for a geometry (such as with a single point, or a multipoint
1688  * whose points are identical, a value of Infinity will be calculated.
1689  *
1690  * @param g the input geometry
1691  * @param d a double to which the result can be stored
1692  *
1693  * @return 0 if no exception occurred
1694  * 2 if an exception occurred
1695  */
1696 extern int GEOS_DLL GEOSMinimumClearance(const GEOSGeometry* g, double* d);
1697 
1698 /* Returns a LineString whose endpoints define the minimum clearance of a geometry.
1699  * If the geometry has no minimum clearance, an empty LineString will be returned.
1700  *
1701  * @param g the input geometry
1702  * @return a LineString, or NULL if an exception occurred.
1703  */
1705 
1706 extern GEOSGeometry GEOS_DLL *GEOSDifference(const GEOSGeometry* g1, const GEOSGeometry* g2);
1707 extern GEOSGeometry GEOS_DLL *GEOSDifferencePrec(const GEOSGeometry* g1, const GEOSGeometry* g2, double gridSize);
1708 extern GEOSGeometry GEOS_DLL *GEOSSymDifference(const GEOSGeometry* g1, const GEOSGeometry* g2);
1709 extern GEOSGeometry GEOS_DLL *GEOSSymDifferencePrec(const GEOSGeometry* g1, const GEOSGeometry* g2, double gridSize);
1711 extern GEOSGeometry GEOS_DLL *GEOSUnion(const GEOSGeometry* g1, const GEOSGeometry* g2);
1712 extern GEOSGeometry GEOS_DLL *GEOSUnionPrec(const GEOSGeometry* g1, const GEOSGeometry* g2, double gridSize);
1714 extern GEOSGeometry GEOS_DLL *GEOSUnaryUnionPrec(const GEOSGeometry* g, double gridSize);
1715 
1716 /* GEOSCoverageUnion is an optimized union algorithm for polygonal inputs that are correctly
1717  * noded and do not overlap. It will not generate an error (return NULL) for inputs that
1718  * do not satisfy this constraint. */
1720 
1721 /* @deprecated in 3.3.0: use GEOSUnaryUnion instead */
1723 
1726 extern GEOSGeometry GEOS_DLL *GEOSMinimumBoundingCircle(const GEOSGeometry* g, double* radius, GEOSGeometry** center);
1727 extern GEOSGeometry GEOS_DLL *GEOSNode(const GEOSGeometry* g);
1728 extern GEOSGeometry GEOS_DLL *GEOSClipByRect(const GEOSGeometry* g, double xmin, double ymin, double xmax, double ymax);
1729 
1730 /*
1731  * all arguments remain ownership of the caller
1732  * (both Geometries and pointers)
1733  */
1734 extern GEOSGeometry GEOS_DLL *GEOSPolygonize(const GEOSGeometry * const geoms[], unsigned int ngeoms);
1735 extern GEOSGeometry GEOS_DLL *GEOSPolygonize_valid(const GEOSGeometry * const geoms[], unsigned int ngeoms);
1736 extern GEOSGeometry GEOS_DLL *GEOSPolygonizer_getCutEdges(const GEOSGeometry * const geoms[], unsigned int ngeoms);
1738  GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid);
1739 
1741 
1743 extern GEOSGeometry GEOS_DLL *GEOSReverse(const GEOSGeometry* g);
1744 extern GEOSGeometry GEOS_DLL *GEOSSimplify(const GEOSGeometry* g, double tolerance);
1746  double tolerance);
1747 
1748 /*
1749  * Return all distinct vertices of input geometry as a MULTIPOINT.
1750  * Note that only 2 dimensions of the vertices are considered when
1751  * testing for equality.
1752  */
1754  const GEOSGeometry* g);
1755 
1756 /*
1757  * Find paths shared between the two given lineal geometries.
1758  *
1759  * Returns a GEOMETRYCOLLECTION having two elements:
1760  * - first element is a MULTILINESTRING containing shared paths
1761  * having the _same_ direction on both inputs
1762  * - second element is a MULTILINESTRING containing shared paths
1763  * having the _opposite_ direction on the two inputs
1764  *
1765  * Returns NULL on exception
1766  */
1768  const GEOSGeometry* g2);
1769 
1770 /*
1771  * Snap first geometry on to second with given tolerance
1772  * Returns a newly allocated geometry, or NULL on exception
1773  */
1774 extern GEOSGeometry GEOS_DLL *GEOSSnap(const GEOSGeometry* g1,
1775  const GEOSGeometry* g2, double tolerance);
1776 
1777 /*
1778  * Return a Delaunay triangulation of the vertex of the given geometry
1779  *
1780  * @param g the input geometry whose vertex will be used as "sites"
1781  * @param tolerance optional snapping tolerance to use for improved robustness
1782  * @param onlyEdges if non-zero will return a MULTILINESTRING, otherwise it will
1783  * return a GEOMETRYCOLLECTION containing triangular POLYGONs.
1784  *
1785  * @return a newly allocated geometry, or NULL on exception
1786  */
1788  const GEOSGeometry *g,
1789  double tolerance,
1790  int onlyEdges);
1791 
1792 /*
1793  * Returns the Voronoi polygons of a set of Vertices given as input
1794  *
1795  * @param g the input geometry whose vertex will be used as sites.
1796  * @param tolerance snapping tolerance to use for improved robustness
1797  * @param onlyEdges whether to return only edges of the voronoi cells
1798  * @param env clipping envelope for the returned diagram, automatically
1799  * determined if NULL.
1800  * The diagram will be clipped to the larger
1801  * of this envelope or an envelope surrounding the sites.
1802  *
1803  * @return a newly allocated geometry, or NULL on exception.
1804  */
1806  const GEOSGeometry *g,
1807  const GEOSGeometry *env,
1808  double tolerance,
1809  int onlyEdges);
1810 /*
1811  * Computes the coordinate where two line segments intersect, if any
1812  *
1813  * @param ax0 x-coordinate of first point in first segment
1814  * @param ay0 y-coordinate of first point in first segment
1815  * @param ax1 x-coordinate of second point in first segment
1816  * @param ay1 y-coordinate of second point in first segment
1817  * @param bx0 x-coordinate of first point in second segment
1818  * @param by0 y-coordinate of first point in second segment
1819  * @param bx1 x-coordinate of second point in second segment
1820  * @param by1 y-coordinate of second point in second segment
1821  * @param cx x-coordinate of intersection point
1822  * @param cy y-coordinate of intersection point
1823  *
1824  * @return 0 on error, 1 on success, -1 if segments do not intersect
1825  */
1826 
1828  double ax0, double ay0,
1829  double ax1, double ay1,
1830  double bx0, double by0,
1831  double bx1, double by1,
1832  double* cx, double* cy);
1833 
1834 /************************************************************************
1835  *
1836  * Binary predicates - return 2 on exception, 1 on true, 0 on false
1837  *
1838  ***********************************************************************/
1839 
1840 extern char GEOS_DLL GEOSDisjoint(const GEOSGeometry* g1, const GEOSGeometry* g2);
1841 extern char GEOS_DLL GEOSTouches(const GEOSGeometry* g1, const GEOSGeometry* g2);
1842 extern char GEOS_DLL GEOSIntersects(const GEOSGeometry* g1, const GEOSGeometry* g2);
1843 extern char GEOS_DLL GEOSCrosses(const GEOSGeometry* g1, const GEOSGeometry* g2);
1844 extern char GEOS_DLL GEOSWithin(const GEOSGeometry* g1, const GEOSGeometry* g2);
1845 extern char GEOS_DLL GEOSContains(const GEOSGeometry* g1, const GEOSGeometry* g2);
1846 extern char GEOS_DLL GEOSOverlaps(const GEOSGeometry* g1, const GEOSGeometry* g2);
1847 extern char GEOS_DLL GEOSEquals(const GEOSGeometry* g1, const GEOSGeometry* g2);
1848 extern char GEOS_DLL GEOSCovers(const GEOSGeometry* g1, const GEOSGeometry* g2);
1849 extern char GEOS_DLL GEOSCoveredBy(const GEOSGeometry* g1, const GEOSGeometry* g2);
1850 
1859 extern char GEOS_DLL GEOSEqualsExact(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance);
1860 
1861 /************************************************************************
1862  *
1863  * Prepared Geometry Binary predicates - return 2 on exception, 1 on true, 0 on false
1864  *
1865  ***********************************************************************/
1866 
1867 /*
1868  * GEOSGeometry ownership is retained by caller
1869  */
1870 extern const GEOSPreparedGeometry GEOS_DLL *GEOSPrepare(const GEOSGeometry* g);
1871 
1873 
1874 extern char GEOS_DLL GEOSPreparedContains(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1875 extern char GEOS_DLL GEOSPreparedContainsProperly(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1876 extern char GEOS_DLL GEOSPreparedCoveredBy(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1877 extern char GEOS_DLL GEOSPreparedCovers(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1878 extern char GEOS_DLL GEOSPreparedCrosses(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1879 extern char GEOS_DLL GEOSPreparedDisjoint(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1880 extern char GEOS_DLL GEOSPreparedIntersects(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1881 extern char GEOS_DLL GEOSPreparedOverlaps(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1882 extern char GEOS_DLL GEOSPreparedTouches(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1883 extern char GEOS_DLL GEOSPreparedWithin(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
1885 extern int GEOS_DLL GEOSPreparedDistance(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2, double *dist);
1886 
1887 /************************************************************************
1888  *
1889  * STRtree functions
1890  *
1891  ***********************************************************************/
1892 
1893 /*
1894  * GEOSGeometry ownership is retained by caller
1895  */
1896 
1897 /*
1898  * Create a new R-tree using the Sort-Tile-Recursive algorithm (STRtree) for two-dimensional
1899  * spatial data.
1900  *
1901  * @param nodeCapacity the maximum number of child nodes that a node may have. The minimum
1902  * recommended capacity value is 4. If unsure, use a default node capacity of 10.
1903  * @return a pointer to the created tree
1904  */
1905 extern GEOSSTRtree GEOS_DLL *GEOSSTRtree_create(size_t nodeCapacity);
1906 
1907 /*
1908  * Insert an item into an STRtree
1909  *
1910  * @param tree the STRtree in which the item should be inserted
1911  * @param g a GEOSGeometry whose envelope corresponds to the extent of 'item'
1912  * @param item the item to insert into the tree
1913  */
1914 extern void GEOS_DLL GEOSSTRtree_insert(GEOSSTRtree *tree,
1915  const GEOSGeometry *g,
1916  void *item);
1917 
1918 /*
1919  * Query an STRtree for items intersecting a specified envelope
1920  *
1921  * @param tree the STRtree to search
1922  * @param g a GEOSGeomety from which a query envelope will be extracted
1923  * @param callback a function to be executed for each item in the tree whose envelope intersects
1924  * the envelope of 'g'. The callback function should take two parameters: a void
1925  * pointer representing the located item in the tree, and a void userdata pointer.
1926  * @param userdata an optional pointer to pe passed to 'callback' as an argument
1927  */
1928 extern void GEOS_DLL GEOSSTRtree_query(GEOSSTRtree *tree,
1929  const GEOSGeometry *g,
1930  GEOSQueryCallback callback,
1931  void *userdata);
1932 /*
1933  * Returns the nearest item in the STRtree to the supplied GEOSGeometry.
1934  * All items in the tree MUST be of type GEOSGeometry. If this is not the case, use
1935  * GEOSSTRtree_nearest_generic instead.
1936 *
1937  * @param tree the STRtree to search
1938  * @param geom the geometry with which the tree should be queried
1939  * @return a const pointer to the nearest GEOSGeometry in the tree to 'geom', or NULL in
1940  * case of exception
1941  */
1942 extern const GEOSGeometry GEOS_DLL *GEOSSTRtree_nearest(GEOSSTRtree *tree, const GEOSGeometry* geom);
1943 
1944 /*
1945  * Returns the nearest item in the STRtree to the supplied item
1946  *
1947  * @param tree the STRtree to search
1948  * @param item the item with which the tree should be queried
1949  * @param itemEnvelope a GEOSGeometry having the bounding box of 'item'
1950  * @param distancefn a function that can compute the distance between two items
1951  * in the STRtree. The function should return zero in case of error,
1952  * and should store the computed distance to the location pointed to by
1953  * the 'distance' argument. The computed distance between two items
1954  * must not exceed the Cartesian distance between their envelopes.
1955  * @param userdata optional pointer to arbitrary data; will be passed to distancefn
1956  * each time it is called.
1957  * @return a const pointer to the nearest item in the tree to 'item', or NULL in
1958  * case of exception
1959  */
1960 extern const void GEOS_DLL *GEOSSTRtree_nearest_generic(GEOSSTRtree *tree,
1961  const void* item,
1962  const GEOSGeometry* itemEnvelope,
1963  GEOSDistanceCallback distancefn,
1964  void* userdata);
1965 /*
1966  * Iterates over all items in the STRtree
1967  *
1968  * @param tree the STRtree over which to iterate
1969  * @param callback a function to be executed for each item in the tree.
1970  */
1971 extern void GEOS_DLL GEOSSTRtree_iterate(GEOSSTRtree *tree,
1972  GEOSQueryCallback callback,
1973  void *userdata);
1974 
1975 /*
1976  * Removes an item from the STRtree
1977  *
1978  * @param tree the STRtree from which to remove an item
1979  * @param g the envelope of the item to remove
1980  * @param the item to remove
1981  * @return 0 if the item was not removed;
1982  * 1 if the item was removed;
1983  * 2 if an exception occurred
1984  */
1985 extern char GEOS_DLL GEOSSTRtree_remove(GEOSSTRtree *tree,
1986  const GEOSGeometry *g,
1987  void *item);
1988 extern void GEOS_DLL GEOSSTRtree_destroy(GEOSSTRtree *tree);
1989 
1990 
1991 /************************************************************************
1992  *
1993  * Unary predicate - return 2 on exception, 1 on true, 0 on false
1994  *
1995  ***********************************************************************/
1996 
1997 extern char GEOS_DLL GEOSisEmpty(const GEOSGeometry* g);
1998 extern char GEOS_DLL GEOSisSimple(const GEOSGeometry* g);
1999 extern char GEOS_DLL GEOSisRing(const GEOSGeometry* g);
2000 extern char GEOS_DLL GEOSHasZ(const GEOSGeometry* g);
2001 extern char GEOS_DLL GEOSisClosed(const GEOSGeometry *g);
2002 
2003 /************************************************************************
2004  *
2005  * Dimensionally Extended 9 Intersection Model related
2006  *
2007  ***********************************************************************/
2008 
2009 /* return 2 on exception, 1 on true, 0 on false */
2010 extern char GEOS_DLL GEOSRelatePattern(const GEOSGeometry* g1, const GEOSGeometry* g2, const char *pat);
2011 
2012 /* return NULL on exception, a string to GEOSFree otherwise */
2013 extern char GEOS_DLL *GEOSRelate(const GEOSGeometry* g1, const GEOSGeometry* g2);
2014 
2015 /* return 2 on exception, 1 on true, 0 on false */
2016 extern char GEOS_DLL GEOSRelatePatternMatch(const char *mat, const char *pat);
2017 
2018 /* return NULL on exception, a string to GEOSFree otherwise */
2019 extern char GEOS_DLL *GEOSRelateBoundaryNodeRule(const GEOSGeometry* g1,
2020  const GEOSGeometry* g2,
2021  int bnr);
2022 
2023 /************************************************************************
2024  *
2025  * Validity checking
2026  *
2027  ***********************************************************************/
2028 
2029 /* return 2 on exception, 1 on true, 0 on false */
2030 extern char GEOS_DLL GEOSisValid(const GEOSGeometry* g);
2031 
2032 /* return NULL on exception, a string to GEOSFree otherwise */
2033 extern char GEOS_DLL *GEOSisValidReason(const GEOSGeometry *g);
2034 /*
2035  * Caller has the responsibility to destroy 'reason' (GEOSFree)
2036  * and 'location' (GEOSGeom_destroy) params
2037  * return 2 on exception, 1 when valid, 0 when invalid
2038  * Use enum GEOSValidFlags values for the flags param.
2039  */
2040 extern char GEOS_DLL GEOSisValidDetail(const GEOSGeometry* g,
2041  int flags,
2042  char** reason, GEOSGeometry** location);
2043 
2045 
2046 /************************************************************************
2047  *
2048  * Geometry info
2049  *
2050  ***********************************************************************/
2051 
2052 /* Return NULL on exception, result must be freed by caller. */
2053 extern char GEOS_DLL *GEOSGeomType(const GEOSGeometry* g);
2054 
2055 /* Return -1 on exception */
2056 extern int GEOS_DLL GEOSGeomTypeId(const GEOSGeometry* g);
2057 
2058 /* Return 0 on exception */
2059 extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g);
2060 
2061 extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
2062 
2063 extern void GEOS_DLL *GEOSGeom_getUserData(const GEOSGeometry* g);
2064 
2065 extern void GEOS_DLL GEOSGeom_setUserData(GEOSGeometry* g, void* userData);
2066 
2067 
2068 /* May be called on all geometries in GEOS 3.x, returns -1 on error and 1
2069  * for non-multi geometries. Older GEOS versions only accept
2070  * GeometryCollections or Multi* geometries here, and are likely to crash
2071  * when fed simple geometries, so beware if you need compatibility with
2072  * old GEOS versions.
2073  */
2074 extern int GEOS_DLL GEOSGetNumGeometries(const GEOSGeometry* g);
2075 
2076 /*
2077  * Return NULL on exception.
2078  * Returned object is a pointer to internal storage:
2079  * it must NOT be destroyed directly.
2080  * Up to GEOS 3.2.0 the input geometry must be a Collection, in
2081  * later version it doesn't matter (getGeometryN(0) for a single will
2082  * return the input).
2083  */
2084 extern const GEOSGeometry GEOS_DLL *GEOSGetGeometryN(const GEOSGeometry* g, int n);
2085 
2086 /* Return -1 on exception */
2087 extern int GEOS_DLL GEOSNormalize(GEOSGeometry* g);
2088 
2089 /* Return NULL on exception */
2091  const GEOSGeometry *g, double gridSize, int flags);
2092 
2093 /* Return -1 on exception */
2094 extern double GEOS_DLL GEOSGeom_getPrecision(const GEOSGeometry *g);
2095 
2096 /* Return -1 on exception */
2097 extern int GEOS_DLL GEOSGetNumInteriorRings(const GEOSGeometry* g);
2098 
2099 /* Return -1 on exception, Geometry must be a LineString. */
2100 extern int GEOS_DLL GEOSGeomGetNumPoints(const GEOSGeometry* g);
2101 
2102 /* Return 0 on exception, otherwise 1, Geometry must be a Point. */
2103 extern int GEOS_DLL GEOSGeomGetX(const GEOSGeometry *g, double *x);
2104 extern int GEOS_DLL GEOSGeomGetY(const GEOSGeometry *g, double *y);
2105 extern int GEOS_DLL GEOSGeomGetZ(const GEOSGeometry *g, double *z);
2106 
2107 /*
2108  * Return NULL on exception, Geometry must be a Polygon.
2109  * Returned object is a pointer to internal storage:
2110  * it must NOT be destroyed directly.
2111  */
2112 extern const GEOSGeometry GEOS_DLL *GEOSGetInteriorRingN(const GEOSGeometry* g, int n);
2113 
2114 /*
2115  * Return NULL on exception, Geometry must be a Polygon.
2116  * Returned object is a pointer to internal storage:
2117  * it must NOT be destroyed directly.
2118  */
2119 extern const GEOSGeometry GEOS_DLL *GEOSGetExteriorRing(const GEOSGeometry* g);
2120 
2121 /* Return -1 on exception */
2122 extern int GEOS_DLL GEOSGetNumCoordinates(const GEOSGeometry* g);
2123 
2124 /*
2125  * Return NULL on exception.
2126  * Geometry must be a LineString, LinearRing or Point.
2127  */
2129 
2130 /*
2131  * Return 0 on exception (or empty geometry)
2132  */
2133 extern int GEOS_DLL GEOSGeom_getDimensions(const GEOSGeometry* g);
2134 
2135 /*
2136  * Return 2 or 3.
2137  */
2139 
2140 /*
2141  * Return 0 on exception
2142  */
2143 extern int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value);
2144 extern int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value);
2145 extern int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value);
2146 extern int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value);
2147 
2148 /*
2149  * Return NULL on exception.
2150  * Must be LineString and must be freed by called.
2151  */
2152 extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN(const GEOSGeometry *g, int n);
2155 
2156 /************************************************************************
2157  *
2158  * Misc functions
2159  *
2160  ***********************************************************************/
2161 
2162 /* Return 0 on exception, 1 otherwise */
2163 extern int GEOS_DLL GEOSArea(const GEOSGeometry* g, double *area);
2164 extern int GEOS_DLL GEOSLength(const GEOSGeometry* g, double *length);
2165 extern int GEOS_DLL GEOSDistance(const GEOSGeometry* g1, const GEOSGeometry* g2,
2166  double *dist);
2167 extern int GEOS_DLL GEOSDistanceIndexed(const GEOSGeometry* g1, const GEOSGeometry* g2,
2168  double *dist);
2169 extern int GEOS_DLL GEOSHausdorffDistance(const GEOSGeometry *g1,
2170  const GEOSGeometry *g2, double *dist);
2172  const GEOSGeometry *g2, double densifyFrac, double *dist);
2173 extern int GEOS_DLL GEOSFrechetDistance(const GEOSGeometry *g1,
2174  const GEOSGeometry *g2, double *dist);
2175 extern int GEOS_DLL GEOSFrechetDistanceDensify(const GEOSGeometry *g1,
2176  const GEOSGeometry *g2, double densifyFrac, double *dist);
2177 extern int GEOS_DLL GEOSGeomGetLength(const GEOSGeometry *g, double *length);
2178 
2179 /* Return 0 on exception, the closest points of the two geometries otherwise.
2180  * The first point comes from g1 geometry and the second point comes from g2.
2181  */
2183  const GEOSGeometry* g1, const GEOSGeometry* g2);
2184 
2185 
2186 /************************************************************************
2187  *
2188  * Algorithms
2189  *
2190  ***********************************************************************/
2191 
2192 /* Walking from A to B:
2193  * return -1 if reaching P takes a counter-clockwise (left) turn
2194  * return 1 if reaching P takes a clockwise (right) turn
2195  * return 0 if P is collinear with A-B
2196  *
2197  * On exceptions, return 2.
2198  *
2199  */
2200 extern int GEOS_DLL GEOSOrientationIndex(double Ax, double Ay, double Bx, double By,
2201  double Px, double Py);
2202 
2203 /************************************************************************
2204  *
2205  * Reader and Writer APIs
2206  *
2207  ***********************************************************************/
2208 
2209 /* WKT Reader */
2211 extern void GEOS_DLL GEOSWKTReader_destroy(GEOSWKTReader* reader);
2212 extern GEOSGeometry GEOS_DLL *GEOSWKTReader_read(GEOSWKTReader* reader, const char *wkt);
2213 
2214 /* WKT Writer */
2216 extern void GEOS_DLL GEOSWKTWriter_destroy(GEOSWKTWriter* writer);
2217 extern char GEOS_DLL *GEOSWKTWriter_write(GEOSWKTWriter* writer, const GEOSGeometry* g);
2218 extern void GEOS_DLL GEOSWKTWriter_setTrim(GEOSWKTWriter *writer, char trim);
2219 extern void GEOS_DLL GEOSWKTWriter_setRoundingPrecision(GEOSWKTWriter *writer, int precision);
2220 extern void GEOS_DLL GEOSWKTWriter_setOutputDimension(GEOSWKTWriter *writer, int dim);
2222 extern void GEOS_DLL GEOSWKTWriter_setOld3D(GEOSWKTWriter *writer, int useOld3D);
2223 
2224 /* WKB Reader */
2226 extern void GEOS_DLL GEOSWKBReader_destroy(GEOSWKBReader* reader);
2227 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_read(GEOSWKBReader* reader, const unsigned char *wkb, size_t size);
2228 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_readHEX(GEOSWKBReader* reader, const unsigned char *hex, size_t size);
2229 
2230 /* WKB Writer */
2232 extern void GEOS_DLL GEOSWKBWriter_destroy(GEOSWKBWriter* writer);
2233 
2234 /* The caller owns the results for these two methods! */
2235 extern unsigned char GEOS_DLL *GEOSWKBWriter_write(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size);
2236 extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size);
2237 
2238 /*
2239  * Specify whether output WKB should be 2d or 3d.
2240  * Return previously set number of dimensions.
2241  */
2242 extern int GEOS_DLL GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter* writer);
2243 extern void GEOS_DLL GEOSWKBWriter_setOutputDimension(GEOSWKBWriter* writer, int newDimension);
2244 
2245 /*
2246  * Specify whether the WKB byte order is big or little endian.
2247  * The return value is the previous byte order.
2248  */
2249 extern int GEOS_DLL GEOSWKBWriter_getByteOrder(const GEOSWKBWriter* writer);
2250 extern void GEOS_DLL GEOSWKBWriter_setByteOrder(GEOSWKBWriter* writer, int byteOrder);
2251 
2252 /*
2253  * Specify whether SRID values should be output.
2254  */
2255 extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter* writer);
2256 extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter* writer, const char writeSRID);
2257 
2258 /*
2259  * Free buffers returned by stuff like GEOSWKBWriter_write(),
2260  * GEOSWKBWriter_writeHEX() and GEOSWKTWriter_write().
2261  */
2262 extern void GEOS_DLL GEOSFree(void *buffer);
2263 
2264 #endif /* #ifndef GEOS_USE_ONLY_R_API */
2265 
2266 
2267 #ifdef __cplusplus
2268 } // extern "C"
2269 #endif
2270 
2271 #endif /* #ifndef GEOS_C_H_INCLUDED */
char * GEOSisValidReason(const GEOSGeometry *g)
char * GEOSGeomType(const GEOSGeometry *g)
GEOSGeometry * GEOSSingleSidedBuffer_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double width, int quadsegs, int joinStyle, double mitreLimit, int leftSide)
GEOSGeometry * GEOSGetCentroid_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
void(* GEOSMessageHandler_r)(const char *message, void *userdata)
Definition: geos_c.h:99
GEOSGeometry * GEOSSnap(const GEOSGeometry *g1, const GEOSGeometry *g2, double tolerance)
int GEOSGetNumInteriorRings(const GEOSGeometry *g)
void GEOSWKTWriter_destroy(GEOSWKTWriter *writer)
char GEOSEqualsExact(const GEOSGeometry *g1, const GEOSGeometry *g2, double tolerance)
void GEOSPreparedGeom_destroy_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *g)
GEOSGeometry * GEOSSimplify_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double tolerance)
GEOSGeometry * GEOSGeom_createEmptyPoint_r(GEOSContextHandle_t handle)
char GEOSPreparedWithin(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
GEOSValidFlags
Definition: geos_c.h:1009
char GEOSPreparedCoveredBy(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
int GEOSBufferParams_setJoinStyle_r(GEOSContextHandle_t handle, GEOSBufferParams *p, int joinStyle)
GEOSGeometry * GEOSInterpolateNormalized(const GEOSGeometry *g, double d)
GEOSGeometry * GEOSEnvelope_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
const GEOSPreparedGeometry * GEOSPrepare(const GEOSGeometry *g)
void * GEOSGeom_getUserData_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSWKTReader * GEOSWKTReader_create_r(GEOSContextHandle_t handle)
char GEOSIntersects(const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSGeom_getXMax_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *value)
char * GEOSRelateBoundaryNodeRule_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, int bnr)
GEOSGeometry * GEOSGeomGetStartPoint(const GEOSGeometry *g)
char GEOSisEmpty(const GEOSGeometry *g)
GEOSGeometry * GEOSSymDifference(const GEOSGeometry *g1, const GEOSGeometry *g2)
char GEOSCovers(const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSUnaryUnionPrec(const GEOSGeometry *g, double gridSize)
int GEOSGeom_getYMax_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *value)
int GEOSSegmentIntersection_r(GEOSContextHandle_t extHandle, double ax0, double ay0, double ax1, double ay1, double bx0, double by0, double bx1, double by1, double *cx, double *cy)
int GEOSSegmentIntersection(double ax0, double ay0, double ax1, double ay1, double bx0, double by0, double bx1, double by1, double *cx, double *cy)
char GEOSPreparedCoveredBy_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
GEOSRelateBoundaryNodeRules
Definition: geos_c.h:969
GEOSGeometry * GEOSBuffer_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double width, int quadsegs)
int GEOSGeom_getYMin_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *value)
GEOSGeometry * GEOSBoundary_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
int GEOSCoordSeq_setY_r(GEOSContextHandle_t handle, GEOSCoordSequence *s, unsigned int idx, double val)
char GEOSPreparedTouches_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
int GEOSFrechetDistanceDensify_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double densifyFrac, double *dist)
GEOSGeometry * GEOSBuffer(const GEOSGeometry *g, double width, int quadsegs)
GEOSGeometry * GEOSInterpolateNormalized_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double d)
int GEOSGeomGetNumPoints_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
void GEOSWKBWriter_setByteOrder(GEOSWKBWriter *writer, int byteOrder)
int GEOSWKBWriter_getOutputDimension_r(GEOSContextHandle_t handle, const GEOSWKBWriter *writer)
int GEOSCoordSeq_getXY(const GEOSCoordSequence *s, unsigned int idx, double *x, double *y)
int GEOSCoordSeq_setX(GEOSCoordSequence *s, unsigned int idx, double val)
GEOSGeometry * GEOSGeom_clone_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSGeom_createEmptyCollection(int type)
int GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter *writer)
int GEOSGeom_getDimensions(const GEOSGeometry *g)
char GEOSisEmpty_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSBufCapStyles
Definition: geos_c.h:405
#define GEOS_DLL
Definition: export.h:28
GEOSByteOrders
Definition: geos_c.h:138
GEOSGeometry * GEOSGeomFromWKT_r(GEOSContextHandle_t handle, const char *wkt)
const void * GEOSSTRtree_nearest_generic(GEOSSTRtree *tree, const void *item, const GEOSGeometry *itemEnvelope, GEOSDistanceCallback distancefn, void *userdata)
int GEOSCoordSeq_getX(const GEOSCoordSequence *s, unsigned int idx, double *val)
char GEOSisValidDetail_r(GEOSContextHandle_t handle, const GEOSGeometry *g, int flags, char **reason, GEOSGeometry **location)
int GEOSGeomGetX(const GEOSGeometry *g, double *x)
GEOSGeometry * GEOSGeom_createPointFromXY_r(GEOSContextHandle_t handle, double x, double y)
char GEOSCovers_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSBufferParams_setMitreLimit(GEOSBufferParams *p, double mitreLimit)
double GEOSGeom_getPrecision(const GEOSGeometry *g)
int GEOSArea(const GEOSGeometry *g, double *area)
GEOSGeometry * GEOSUnaryUnion_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSGeomGetPointN(const GEOSGeometry *g, int n)
double GEOSProjectNormalized_r(GEOSContextHandle_t handle, const GEOSGeometry *g, const GEOSGeometry *p)
GEOSGeometry * GEOSMinimumRotatedRectangle_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
char GEOSHasZ(const GEOSGeometry *g)
char GEOSRelatePattern(const GEOSGeometry *g1, const GEOSGeometry *g2, const char *pat)
GEOSSTRtree * GEOSSTRtree_create_r(GEOSContextHandle_t handle, size_t nodeCapacity)
void GEOSWKTReader_destroy(GEOSWKTReader *reader)
void GEOSGeom_setUserData_r(GEOSContextHandle_t handle, GEOSGeometry *g, void *userData)
char GEOSisSimple_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSWKBReader_readHEX(GEOSWKBReader *reader, const unsigned char *hex, size_t size)
int GEOS_setWKBByteOrder(int byteOrder)
GEOSBufferParams * GEOSBufferParams_create_r(GEOSContextHandle_t handle)
void GEOSSTRtree_destroy(GEOSSTRtree *tree)
int GEOSGeomTypeId_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
struct GEOSWKBWriter_t GEOSWKBWriter
Definition: geos_c.h:1266
GEOSGeometry * GEOSOffsetCurve(const GEOSGeometry *g, double width, int quadsegs, int joinStyle, double mitreLimit)
int GEOSCoordSeq_getOrdinate_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int idx, unsigned int dim, double *val)
GEOSGeometry * GEOSSingleSidedBuffer(const GEOSGeometry *g, double width, int quadsegs, int joinStyle, double mitreLimit, int leftSide)
GEOSGeometry * GEOSWKBReader_read_r(GEOSContextHandle_t handle, GEOSWKBReader *reader, const unsigned char *wkb, size_t size)
int GEOSGeom_getDimensions_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSBuildArea(const GEOSGeometry *g)
int GEOSBufferParams_setEndCapStyle_r(GEOSContextHandle_t handle, GEOSBufferParams *p, int style)
GEOSGeometry * GEOSVoronoiDiagram_r(GEOSContextHandle_t extHandle, const GEOSGeometry *g, const GEOSGeometry *env, double tolerance, int onlyEdges)
const GEOSGeometry * GEOSGetGeometryN_r(GEOSContextHandle_t handle, const GEOSGeometry *g, int n)
char GEOSPreparedContains(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
GEOSGeometry * GEOSGetCentroid(const GEOSGeometry *g)
void GEOSSTRtree_iterate_r(GEOSContextHandle_t handle, GEOSSTRtree *tree, GEOSQueryCallback callback, void *userdata)
GEOSGeometry * GEOSBufferWithStyle(const GEOSGeometry *g, double width, int quadsegs, int endCapStyle, int joinStyle, double mitreLimit)
GEOSGeometry * GEOSUnaryUnion(const GEOSGeometry *g)
unsigned char * GEOSWKBWriter_writeHEX_r(GEOSContextHandle_t handle, GEOSWKBWriter *writer, const GEOSGeometry *g, size_t *size)
void GEOSSetSRID(GEOSGeometry *g, int SRID)
GEOSGeometry * GEOSSnap_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double tolerance)
GEOSMessageHandler GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler ef)
char * GEOSisValidReason_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
const GEOSGeometry * GEOSSTRtree_nearest_r(GEOSContextHandle_t handle, GEOSSTRtree *tree, const GEOSGeometry *geom)
GEOSContextHandle_t GEOS_init_r()
char GEOSPreparedIntersects(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
const void * GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t handle, GEOSSTRtree *tree, const void *item, const GEOSGeometry *itemEnvelope, GEOSDistanceCallback distancefn, void *userdata)
char GEOSOverlaps_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
char * GEOSRelateBoundaryNodeRule(const GEOSGeometry *g1, const GEOSGeometry *g2, int bnr)
double GEOSProject_r(GEOSContextHandle_t handle, const GEOSGeometry *g, const GEOSGeometry *p)
void GEOSWKBWriter_destroy(GEOSWKBWriter *writer)
int GEOSArea_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *area)
char * GEOSRelate_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSGeom_getCoordinateDimension(const GEOSGeometry *g)
struct GEOSBufParams_t GEOSBufferParams
Definition: geos_c.h:112
void GEOSWKTWriter_destroy_r(GEOSContextHandle_t handle, GEOSWKTWriter *writer)
int GEOSFrechetDistance_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
int GEOSHausdorffDistance(const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
int GEOSCoordSeq_getDimensions(const GEOSCoordSequence *s, unsigned int *dims)
int GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t handle, GEOSCoordSequence *s, unsigned int idx, unsigned int dim, double val)
int GEOSCoordSeq_setZ_r(GEOSContextHandle_t handle, GEOSCoordSequence *s, unsigned int idx, double val)
int GEOSCoordSeq_getY_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int idx, double *val)
void( GEOSInterruptCallback)()
Definition: geos_c.h:160
GEOSGeometry * GEOSBufferWithParams_r(GEOSContextHandle_t handle, const GEOSGeometry *g, const GEOSBufferParams *p, double width)
int GEOSGeomGetNumPoints(const GEOSGeometry *g)
void GEOSWKBWriter_setIncludeSRID_r(GEOSContextHandle_t handle, GEOSWKBWriter *writer, const char writeSRID)
GEOSContextHandle_t initGEOS_r(GEOSMessageHandler notice_function, GEOSMessageHandler error_function)
int GEOSGeom_getYMax(const GEOSGeometry *g, double *value)
const GEOSPreparedGeometry * GEOSPrepare_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
const GEOSGeometry * GEOSGetExteriorRing(const GEOSGeometry *g)
GEOSGeometry * GEOSClipByRect_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double xmin, double ymin, double xmax, double ymax)
int GEOSCoordSeq_getXYZ_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int idx, double *x, double *y, double *z)
GEOSGeometry * GEOSMinimumWidth_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSCoordSequence * GEOSPreparedNearestPoints_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
int GEOSLength(const GEOSGeometry *g, double *length)
char GEOSContains_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSGeomFromWKB_buf_r(GEOSContextHandle_t handle, const unsigned char *wkb, size_t size)
struct GEOSWKTReader_t GEOSWKTReader
Definition: geos_c.h:1263
int GEOSCoordSeq_getXYZ(const GEOSCoordSequence *s, unsigned int idx, double *x, double *y, double *z)
int GEOSCoordSeq_isCCW(const GEOSCoordSequence *s, char *is_ccw)
GEOSGeometry * GEOSGeomFromWKB_buf(const unsigned char *wkb, size_t size)
GEOSWKTWriter * GEOSWKTWriter_create_r(GEOSContextHandle_t handle)
char GEOSRelatePattern_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, const char *pat)
int GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
void * GEOSGeom_getUserData(const GEOSGeometry *g)
GEOSGeometry * GEOSGeom_createEmptyPolygon()
char GEOSEquals_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSConvexHull_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
char GEOSSTRtree_remove(GEOSSTRtree *tree, const GEOSGeometry *g, void *item)
int GEOSNormalize(GEOSGeometry *g)
GEOSMessageHandler_r GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler_r nf, void *userData)
int GEOSCoordSeq_getX_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int idx, double *val)
char GEOSWithin_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
void GEOSWKTWriter_setRoundingPrecision_r(GEOSContextHandle_t handle, GEOSWKTWriter *writer, int precision)
int GEOSGeomGetLength_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *length)
char * GEOSGeomToWKT(const GEOSGeometry *g)
void initGEOS(GEOSMessageHandler notice_function, GEOSMessageHandler error_function)
int GEOSGetSRID_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
int GEOS_getWKBOutputDims_r(GEOSContextHandle_t handle)
GEOSGeometry * GEOSSharedPaths_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSGetNumCoordinates_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
char GEOSPreparedCrosses(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
GEOSGeometry * GEOSWKTReader_read(GEOSWKTReader *reader, const char *wkt)
void(* GEOSMessageHandler)(const char *fmt,...)
Definition: geos_c.h:87
GEOSCoordSequence * GEOSCoordSeq
Definition: geos_c.h:119
struct GEOSGeom_t GEOSGeometry
Definition: geos_c.h:108
GEOSGeometry * GEOSCoverageUnion_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
int GEOSWKTWriter_getOutputDimension(GEOSWKTWriter *writer)
double GEOSGeom_getPrecision_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSWKTReader * GEOSWKTReader_create()
GEOSInterruptCallback * GEOS_interruptRegisterCallback(GEOSInterruptCallback *cb)
int GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double densifyFrac, double *dist)
GEOSCoordSequence * GEOSNearestPoints_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSWKBReader_read(GEOSWKBReader *reader, const unsigned char *wkb, size_t size)
int GEOSBufferParams_setSingleSided(GEOSBufferParams *p, int singleSided)
GEOSGeometry * GEOSCoverageUnion(const GEOSGeometry *g)
const GEOSGeometry * GEOSGetGeometryN(const GEOSGeometry *g, int n)
GEOSGeometry * GEOSSharedPaths(const GEOSGeometry *g1, const GEOSGeometry *g2)
void GEOSWKBReader_destroy(GEOSWKBReader *reader)
GEOSGeometry * GEOSConvexHull(const GEOSGeometry *g)
GEOSGeometry * GEOSGeomGetPointN_r(GEOSContextHandle_t handle, const GEOSGeometry *g, int n)
int GEOSGetNumGeometries(const GEOSGeometry *g)
char GEOSRelatePatternMatch(const char *mat, const char *pat)
int GEOSFrechetDistanceDensify(const GEOSGeometry *g1, const GEOSGeometry *g2, double densifyFrac, double *dist)
GEOSGeometry * GEOSDifference_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOS_setWKBOutputDims_r(GEOSContextHandle_t handle, int newDims)
GEOSGeometry * GEOSSimplify(const GEOSGeometry *g, double tolerance)
int GEOSBufferParams_setQuadrantSegments(GEOSBufferParams *p, int quadSegs)
GEOSGeometry * GEOSGeom_createEmptyPoint()
GEOSGeometry * GEOSGeom_createPoint_r(GEOSContextHandle_t handle, GEOSCoordSequence *s)
struct GEOSContextHandle_HS * GEOSContextHandle_t
Definition: geos_c.h:85
GEOSGeometry * GEOSGeom_createLineString(GEOSCoordSequence *s)
GEOSWKBWriter * GEOSWKBWriter_create_r(GEOSContextHandle_t handle)
GEOSGeometry * GEOSTopologyPreserveSimplify_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double tolerance)
int GEOSLength_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *length)
void GEOSFree_r(GEOSContextHandle_t handle, void *buffer)
char GEOSWKBWriter_getIncludeSRID_r(GEOSContextHandle_t handle, const GEOSWKBWriter *writer)
unsigned char * GEOSWKBWriter_write_r(GEOSContextHandle_t handle, GEOSWKBWriter *writer, const GEOSGeometry *g, size_t *size)
unsigned char * GEOSWKBWriter_writeHEX(GEOSWKBWriter *writer, const GEOSGeometry *g, size_t *size)
GEOSGeometry * GEOSGeom_createEmptyLineString_r(GEOSContextHandle_t handle)
char GEOSPreparedCovers(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
const GEOSCoordSequence * GEOSGeom_getCoordSeq_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSPolygonize_valid(const GEOSGeometry *const geoms[], unsigned int ngeoms)
int GEOSOrientationIndex_r(GEOSContextHandle_t handle, double Ax, double Ay, double Bx, double By, double Px, double Py)
char GEOSTouches(const GEOSGeometry *g1, const GEOSGeometry *g2)
void GEOSFree(void *buffer)
int GEOSCoordSeq_setXYZ(GEOSCoordSequence *s, unsigned int idx, double x, double y, double z)
char GEOSisSimple(const GEOSGeometry *g)
int GEOSCoordSeq_isCCW_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, char *is_ccw)
char GEOSCoveredBy_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSCoordSeq_setX_r(GEOSContextHandle_t handle, GEOSCoordSequence *s, unsigned int idx, double val)
GEOSGeometry * GEOSGeomGetEndPoint(const GEOSGeometry *g)
int GEOSPreparedDistance(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2, double *dist)
char GEOSisClosed_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
int GEOSDistanceIndexed(const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
int GEOSGeomTypeId(const GEOSGeometry *g)
int GEOSCoordSeq_getZ(const GEOSCoordSequence *s, unsigned int idx, double *val)
const GEOSGeometry * GEOSGetInteriorRingN_r(GEOSContextHandle_t handle, const GEOSGeometry *g, int n)
void GEOSCoordSeq_destroy(GEOSCoordSequence *s)
const GEOSGeometry * GEOSGetInteriorRingN(const GEOSGeometry *g, int n)
int GEOSCoordSeq_setOrdinate(GEOSCoordSequence *s, unsigned int idx, unsigned int dim, double val)
GEOSGeometry * GEOSMinimumRotatedRectangle(const GEOSGeometry *g)
void(* GEOSQueryCallback)(void *item, void *userdata)
Definition: geos_c.h:143
void GEOSGeom_destroy_r(GEOSContextHandle_t handle, GEOSGeometry *g)
char GEOSCrosses(const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSMinimumClearanceLine_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSEnvelope(const GEOSGeometry *g)
int GEOSBufferParams_setJoinStyle(GEOSBufferParams *p, int joinStyle)
GEOSGeometry * GEOSReverse_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
int GEOSBufferParams_setEndCapStyle(GEOSBufferParams *p, int style)
GEOSGeometry * GEOSMaximumInscribedCircle(const GEOSGeometry *g, double tolerance)
void GEOS_interruptRequest()
GEOSGeometry * GEOSGeom_createCollection(int type, GEOSGeometry **geoms, unsigned int ngeoms)
char * GEOSGeomToWKT_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
void GEOSWKBReader_destroy_r(GEOSContextHandle_t handle, GEOSWKBReader *reader)
GEOSBufferParams * GEOSBufferParams_create()
int GEOSGeom_getXMin_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *value)
int GEOSCoordSeq_getXY_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int idx, double *x, double *y)
int GEOSGeomGetLength(const GEOSGeometry *g, double *length)
int GEOSBufferParams_setMitreLimit_r(GEOSContextHandle_t handle, GEOSBufferParams *p, double mitreLimit)
char GEOSPreparedOverlaps(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
int GEOSGeom_getXMax(const GEOSGeometry *g, double *value)
char GEOSisRing(const GEOSGeometry *g)
char GEOSPreparedDisjoint_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
GEOSGeometry * GEOSGeom_createLineString_r(GEOSContextHandle_t handle, GEOSCoordSequence *s)
char GEOSPreparedDisjoint(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
int GEOSGeomGetZ(const GEOSGeometry *g, double *z)
void GEOSWKTWriter_setOutputDimension_r(GEOSContextHandle_t handle, GEOSWKTWriter *writer, int dim)
unsigned char * GEOSGeomToHEX_buf(const GEOSGeometry *g, size_t *size)
void GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter *writer, const char writeSRID)
GEOSGeometry * GEOSBufferWithStyle_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double width, int quadsegs, int endCapStyle, int joinStyle, double mitreLimit)
GEOSGeometry * GEOSPolygonizer_getCutEdges(const GEOSGeometry *const geoms[], unsigned int ngeoms)
GEOSGeometry * GEOSDifferencePrec(const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
const GEOSGeometry * GEOSSTRtree_nearest(GEOSSTRtree *tree, const GEOSGeometry *geom)
GEOSGeometry * GEOSMinimumClearanceLine(const GEOSGeometry *g)
unsigned char * GEOSWKBWriter_write(GEOSWKBWriter *writer, const GEOSGeometry *g, size_t *size)
GEOSWKTWriter * GEOSWKTWriter_create()
GEOSCoordSequence * GEOSPreparedNearestPoints(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
char GEOSRelatePatternMatch_r(GEOSContextHandle_t handle, const char *mat, const char *pat)
GEOSGeometry * GEOSTopologyPreserveSimplify(const GEOSGeometry *g, double tolerance)
void GEOSWKTWriter_setOld3D_r(GEOSContextHandle_t handle, GEOSWKTWriter *writer, int useOld3D)
GEOSWKBWriter * GEOSWKBWriter_create()
void GEOSWKBWriter_destroy_r(GEOSContextHandle_t handle, GEOSWKBWriter *writer)
char * GEOSWKTWriter_write(GEOSWKTWriter *writer, const GEOSGeometry *g)
void GEOSGeom_setUserData(GEOSGeometry *g, void *userData)
int GEOSCoordSeq_getSize(const GEOSCoordSequence *s, unsigned int *size)
struct GEOSPrepGeom_t GEOSPreparedGeometry
Definition: geos_c.h:109
GEOSGeometry * GEOSVoronoiDiagram(const GEOSGeometry *g, const GEOSGeometry *env, double tolerance, int onlyEdges)
char GEOSDisjoint(const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSPolygonize(const GEOSGeometry *const geoms[], unsigned int ngeoms)
void GEOS_finish_r(GEOSContextHandle_t handle)
GEOSGeometry * GEOSGeom_createPoint(GEOSCoordSequence *s)
GEOSGeometry * GEOSBufferWithParams(const GEOSGeometry *g, const GEOSBufferParams *p, double width)
GEOSGeometry * GEOSGeom_extractUniquePoints(const GEOSGeometry *g)
void GEOSSTRtree_insert_r(GEOSContextHandle_t handle, GEOSSTRtree *tree, const GEOSGeometry *g, void *item)
char GEOSisValid_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
char * GEOSGeomType_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
int GEOSGeom_getYMin(const GEOSGeometry *g, double *value)
char * GEOSRelate(const GEOSGeometry *g1, const GEOSGeometry *g2)
struct GEOSWKBReader_t GEOSWKBReader
Definition: geos_c.h:1265
GEOSGeometry * GEOSUnion_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSBuildArea_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSDifferencePrec_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
int GEOSGeomGetX_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *x)
GEOSWKBReader * GEOSWKBReader_create_r(GEOSContextHandle_t handle)
GEOSGeometry * GEOSMinimumWidth(const GEOSGeometry *g)
char GEOSPreparedTouches(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
void GEOSSTRtree_insert(GEOSSTRtree *tree, const GEOSGeometry *g, void *item)
void finishGEOS_r(GEOSContextHandle_t handle)
GEOSGeometry * GEOSGeom_createEmptyLineString()
GEOSGeometry * GEOSMaximumInscribedCircle_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double tolerance)
GEOSGeometry * GEOSUnionPrec_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
char GEOSSTRtree_remove_r(GEOSContextHandle_t handle, GEOSSTRtree *tree, const GEOSGeometry *g, void *item)
char GEOSTouches_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
char GEOSisValidDetail(const GEOSGeometry *g, int flags, char **reason, GEOSGeometry **location)
GEOSGeometry * GEOSPolygonize_full_r(GEOSContextHandle_t handle, const GEOSGeometry *input, GEOSGeometry **cuts, GEOSGeometry **dangles, GEOSGeometry **invalidRings)
int GEOSGetNumInteriorRings_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSWKBReader_readHEX_r(GEOSContextHandle_t handle, GEOSWKBReader *reader, const unsigned char *hex, size_t size)
int GEOSFrechetDistance(const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
GEOSGeometry * GEOSGeom_setPrecision(const GEOSGeometry *g, double gridSize, int flags)
GEOSGeometry * GEOSSymDifference_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
void GEOSGeom_destroy(GEOSGeometry *g)
const char * GEOSversion()
int GEOSPreparedDistance_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2, double *dist)
int GEOS_getWKBOutputDims()
GEOSGeometry * GEOSDifference(const GEOSGeometry *g1, const GEOSGeometry *g2)
char GEOSisClosed(const GEOSGeometry *g)
int GEOSBufferParams_setSingleSided_r(GEOSContextHandle_t handle, GEOSBufferParams *p, int singleSided)
void GEOSPreparedGeom_destroy(const GEOSPreparedGeometry *g)
void GEOSSTRtree_query(GEOSSTRtree *tree, const GEOSGeometry *g, GEOSQueryCallback callback, void *userdata)
int GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int *dims)
GEOSBufJoinStyles
Definition: geos_c.h:411
int GEOS_setWKBOutputDims(int newDims)
GEOSCoordSequence * GEOSCoordSeq_create_r(GEOSContextHandle_t handle, unsigned int size, unsigned int dims)
int GEOSDistance_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
GEOSGeometry * GEOSBoundary(const GEOSGeometry *g)
GEOSGeometry * GEOSLineMerge_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSMinimumBoundingCircle(const GEOSGeometry *g, double *radius, GEOSGeometry **center)
GEOSSTRtree * GEOSSTRtree_create(size_t nodeCapacity)
GEOSGeometry * GEOSUnaryUnionPrec_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double gridSize)
void GEOSBufferParams_destroy_r(GEOSContextHandle_t handle, GEOSBufferParams *parms)
void GEOSSTRtree_destroy_r(GEOSContextHandle_t handle, GEOSSTRtree *tree)
GEOSCoordSequence * GEOSCoordSeq_create(unsigned int size, unsigned int dims)
void GEOSWKTWriter_setOutputDimension(GEOSWKTWriter *writer, int dim)
int GEOSBufferParams_setQuadrantSegments_r(GEOSContextHandle_t handle, GEOSBufferParams *p, int quadSegs)
int GEOSWKBWriter_getByteOrder(const GEOSWKBWriter *writer)
GEOSGeometry * GEOSGeomFromWKT(const char *wkt)
char GEOSOverlaps(const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSCoordSeq_setXY_r(GEOSContextHandle_t handle, GEOSCoordSequence *s, unsigned int idx, double x, double y)
char GEOSPreparedIntersects_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
void finishGEOS(void)
int GEOSDistance(const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
struct GEOSCoordSeq_t GEOSCoordSequence
Definition: geos_c.h:110
char GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter *writer)
GEOSGeometry * GEOSGeom_clone(const GEOSGeometry *g)
int GEOS_setWKBByteOrder_r(GEOSContextHandle_t handle, int byteOrder)
GEOSGeometry * GEOSInterpolate(const GEOSGeometry *g, double d)
GEOSGeometry * GEOSGeom
Definition: geos_c.h:118
GEOSGeometry * GEOSGeom_extractUniquePoints_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSGeom_createPointFromXY(double x, double y)
const GEOSCoordSequence * GEOSGeom_getCoordSeq(const GEOSGeometry *g)
int GEOSCoordSeq_setZ(GEOSCoordSequence *s, unsigned int idx, double val)
char GEOSPreparedOverlaps_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
void GEOSWKBWriter_setOutputDimension_r(GEOSContextHandle_t handle, GEOSWKBWriter *writer, int newDimension)
void GEOSSTRtree_iterate(GEOSSTRtree *tree, GEOSQueryCallback callback, void *userdata)
int GEOSOrientationIndex(double Ax, double Ay, double Bx, double By, double Px, double Py)
int GEOSMinimumClearance(const GEOSGeometry *g, double *d)
GEOSGeometry * GEOSGeom_createPolygon_r(GEOSContextHandle_t handle, GEOSGeometry *shell, GEOSGeometry **holes, unsigned int nholes)
char GEOSPreparedContainsProperly_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
GEOSGeometry * GEOSGeom_createLinearRing(GEOSCoordSequence *s)
GEOSGeometry * GEOSIntersection_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSCoordSeq_setY(GEOSCoordSequence *s, unsigned int idx, double val)
int GEOSHausdorffDistance_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
int GEOSCoordSeq_getOrdinate(const GEOSCoordSequence *s, unsigned int idx, unsigned int dim, double *val)
int GEOSGeom_getXMin(const GEOSGeometry *g, double *value)
char GEOSEquals(const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSCoordSeq_setXY(GEOSCoordSequence *s, unsigned int idx, double x, double y)
char GEOSContains(const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSGeomGetStartPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSMessageHandler GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf)
GEOSGeometry * GEOSPointOnSurface(const GEOSGeometry *g)
GEOSGeometry * GEOSGeomGetEndPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
char GEOSisValid(const GEOSGeometry *g)
char GEOSEqualsExact_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double tolerance)
GEOSGeometry * GEOSDelaunayTriangulation_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double tolerance, int onlyEdges)
int GEOSHausdorffDistanceDensify(const GEOSGeometry *g1, const GEOSGeometry *g2, double densifyFrac, double *dist)
double GEOSProjectNormalized(const GEOSGeometry *g, const GEOSGeometry *p)
char GEOSDisjoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSOffsetCurve_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double width, int quadsegs, int joinStyle, double mitreLimit)
GEOSMessageHandler_r GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler_r ef, void *userData)
GEOSGeometry * GEOSPointOnSurface_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSMakeValid(const GEOSGeometry *g)
GEOSGeometry * GEOSMakeValid_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
struct GEOSSTRtree_t GEOSSTRtree
Definition: geos_c.h:111
GEOSGeometry * GEOSPolygonize_r(GEOSContextHandle_t handle, const GEOSGeometry *const geoms[], unsigned int ngeoms)
int(* GEOSDistanceCallback)(const void *item1, const void *item2, double *distance, void *userdata)
Definition: geos_c.h:144
char GEOSCrosses_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
void GEOSWKTWriter_setTrim(GEOSWKTWriter *writer, char trim)
char GEOSCoveredBy(const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSNode_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeomTypes
Definition: geos_c.h:126
GEOSGeometry * GEOSSymDifferencePrec_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
void GEOSSetSRID_r(GEOSContextHandle_t handle, GEOSGeometry *g, int SRID)
unsigned char * GEOSGeomToWKB_buf(const GEOSGeometry *g, size_t *size)
char GEOSPreparedContainsProperly(const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
struct GEOSWKTWriter_t GEOSWKTWriter
Definition: geos_c.h:1264
void GEOSBufferParams_destroy(GEOSBufferParams *parms)
char GEOSIntersects_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2)
char GEOSPreparedContains_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
int GEOSGetNumCoordinates(const GEOSGeometry *g)
void GEOSWKTWriter_setOld3D(GEOSWKTWriter *writer, int useOld3D)
int GEOS_getWKBByteOrder()
GEOSGeometry * GEOSGeom_createEmptyPolygon_r(GEOSContextHandle_t handle)
GEOSGeometry * GEOSIntersectionPrec_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
GEOSWKBReader * GEOSWKBReader_create()
GEOSGeometry * GEOSGeom_createPolygon(GEOSGeometry *shell, GEOSGeometry **holes, unsigned int nholes)
void GEOSWKTWriter_setTrim_r(GEOSContextHandle_t handle, GEOSWKTWriter *writer, char trim)
const GEOSGeometry * GEOSGetExteriorRing_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSCoordSequence * GEOSCoordSeq_clone(const GEOSCoordSequence *s)
GEOSGeometry * GEOSUnionCascaded_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSGeom_createCollection_r(GEOSContextHandle_t handle, int type, GEOSGeometry **geoms, unsigned int ngeoms)
int GEOSGetNumGeometries_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSInterpolate_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double d)
GEOSCoordSequence * GEOSCoordSeq_clone_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s)
GEOSGeometry * GEOSGeomFromHEX_buf_r(GEOSContextHandle_t handle, const unsigned char *hex, size_t size)
void GEOSWKBWriter_setOutputDimension(GEOSWKBWriter *writer, int newDimension)
void GEOSWKBWriter_setByteOrder_r(GEOSContextHandle_t handle, GEOSWKBWriter *writer, int byteOrder)
GEOSGeometry * GEOSIntersectionPrec(const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
void GEOSWKTWriter_setRoundingPrecision(GEOSWKTWriter *writer, int precision)
GEOSGeometry * GEOSPolygonize_full(const GEOSGeometry *input, GEOSGeometry **cuts, GEOSGeometry **dangles, GEOSGeometry **invalid)
GEOSGeometry * GEOSReverse(const GEOSGeometry *g)
char GEOSPreparedWithin_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
void GEOS_interruptCancel()
char * GEOSWKTWriter_write_r(GEOSContextHandle_t handle, GEOSWKTWriter *writer, const GEOSGeometry *g)
int GEOSCoordSeq_getSize_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int *size)
char GEOSPreparedCovers_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)
GEOSGeometry * GEOSWKTReader_read_r(GEOSContextHandle_t handle, GEOSWKTReader *reader, const char *wkt)
int GEOSCoordSeq_getY(const GEOSCoordSequence *s, unsigned int idx, double *val)
GEOSGeometry * GEOSLargestEmptyCircle(const GEOSGeometry *g, const GEOSGeometry *boundary, double tolerance)
GEOSGeometry * GEOSGeomFromHEX_buf(const unsigned char *hex, size_t size)
GEOSGeometry * GEOSIntersection(const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSGeomGetY_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *y)
char GEOSWithin(const GEOSGeometry *g1, const GEOSGeometry *g2)
int GEOSGeomGetY(const GEOSGeometry *g, double *y)
int GEOSWKBWriter_getByteOrder_r(GEOSContextHandle_t handle, const GEOSWKBWriter *writer)
GEOSGeometry * GEOSNode(const GEOSGeometry *g)
int GEOSGeomGetZ_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *z)
int GEOSGetSRID(const GEOSGeometry *g)
GEOSGeometry * GEOSUnionCascaded(const GEOSGeometry *g)
GEOSGeometry * GEOSLineMerge(const GEOSGeometry *g)
GEOSGeometry * GEOSSymDifferencePrec(const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
GEOSGeometry * GEOSLargestEmptyCircle_r(GEOSContextHandle_t handle, const GEOSGeometry *g, const GEOSGeometry *boundary, double tolerance)
void GEOSCoordSeq_destroy_r(GEOSContextHandle_t handle, GEOSCoordSequence *s)
int GEOSDistanceIndexed_r(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2, double *dist)
int GEOSCoordSeq_setXYZ_r(GEOSContextHandle_t handle, GEOSCoordSequence *s, unsigned int idx, double x, double y, double z)
GEOSGeometry * GEOSGeom_createLinearRing_r(GEOSContextHandle_t handle, GEOSCoordSequence *s)
int GEOSNormalize_r(GEOSContextHandle_t handle, GEOSGeometry *g)
int GEOS_getWKBByteOrder_r(GEOSContextHandle_t handle)
double GEOSProject(const GEOSGeometry *g, const GEOSGeometry *p)
GEOSCoordSequence * GEOSNearestPoints(const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSPolygonizer_getCutEdges_r(GEOSContextHandle_t handle, const GEOSGeometry *const geoms[], unsigned int ngeoms)
unsigned char * GEOSGeomToWKB_buf_r(GEOSContextHandle_t handle, const GEOSGeometry *g, size_t *size)
void GEOSWKTReader_destroy_r(GEOSContextHandle_t handle, GEOSWKTReader *reader)
GEOSGeometry * GEOSClipByRect(const GEOSGeometry *g, double xmin, double ymin, double xmax, double ymax)
unsigned char * GEOSGeomToHEX_buf_r(GEOSContextHandle_t handle, const GEOSGeometry *g, size_t *size)
int GEOSMinimumClearance_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *distance)
GEOSGeometry * GEOSMinimumBoundingCircle_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *radius, GEOSGeometry **center)
char GEOSisRing_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
GEOSGeometry * GEOSUnion(const GEOSGeometry *g1, const GEOSGeometry *g2)
GEOSGeometry * GEOSDelaunayTriangulation(const GEOSGeometry *g, double tolerance, int onlyEdges)
int GEOSWKTWriter_getOutputDimension_r(GEOSContextHandle_t handle, GEOSWKTWriter *writer)
GEOSGeometry * GEOSGeom_setPrecision_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double gridSize, int flags)
int GEOSCoordSeq_getZ_r(GEOSContextHandle_t handle, const GEOSCoordSequence *s, unsigned int idx, double *val)
GEOSGeometry * GEOSPolygonize_valid_r(GEOSContextHandle_t handle, const GEOSGeometry *const geoms[], unsigned int ngems)
GEOSGeometry * GEOSUnionPrec(const GEOSGeometry *g1, const GEOSGeometry *g2, double gridSize)
GEOSGeometry * GEOSGeom_createEmptyCollection_r(GEOSContextHandle_t handle, int type)
void GEOSSTRtree_query_r(GEOSContextHandle_t handle, GEOSSTRtree *tree, const GEOSGeometry *g, GEOSQueryCallback callback, void *userdata)
char GEOSHasZ_r(GEOSContextHandle_t handle, const GEOSGeometry *g)
char GEOSPreparedCrosses_r(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2)