MobilityDB 1.1
pgis_call.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2023, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2023, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
27 *
28 *****************************************************************************/
29
36#ifndef __PGIS_CALL_H__
37#define __PGIS_CALL_H__
38
39/*****************************************************************************/
40
41/* PostgreSQL */
42#include <postgres.h>
43/* PostGIS */
44#include <liblwgeom.h>
45/* MEOS */
46#include "general/meos_catalog.h"
47#include "general/span.h"
48#include "general/temporal.h"
49
50/* Functions adapted from lwgeom_box.c */
51
52extern LWGEOM *box2d_to_lwgeom(GBOX *box, int srid);
53
54/* Functions adapted from lwgeom_box3d.c */
55
56extern LWGEOM *box3d_to_lwgeom(BOX3D *box);
57
58/* Functions adapted from lwgeom_functions_basic.c */
59
60/* The implementation of this function changed in PostGIS version 3.2 */
61extern GSERIALIZED *gserialized_boundary(const GSERIALIZED *geom1);
63 const GSERIALIZED *geom2);
65 const GSERIALIZED *geom2);
66extern double gserialized_distance(const GSERIALIZED *geom1,
67 const GSERIALIZED *geom2);
68extern double gserialized_3Ddistance(const GSERIALIZED *geom1,
69 const GSERIALIZED *geom2);
70extern bool gserialized_3Dintersects(const GSERIALIZED *geom1,
71 const GSERIALIZED *geom2);
72extern bool gserialized_dwithin(const GSERIALIZED *geom1,
73 const GSERIALIZED *geom2, double tolerance);
74extern bool gserialized_dwithin3d(const GSERIALIZED *geom1,
75 const GSERIALIZED *geom2, double tolerance);
76extern bool gserialized_relate_pattern(const GSERIALIZED *geom1,
77 const GSERIALIZED *geom2, char *patt);
79extern bool gserialized_azimuth(GSERIALIZED *geom1, GSERIALIZED *geom2,
80 double *result);
81
82/* Functions adapted from lwgeom_geos.c */
83
84extern bool gserialized_inter_contains(const GSERIALIZED *geom1,
85 const GSERIALIZED *geom2, bool inter);
86extern bool gserialized_touches(const GSERIALIZED *geom1,
87 const GSERIALIZED *geom2);
89 const GSERIALIZED *geom2);
90extern GSERIALIZED *gserialized_array_union(GSERIALIZED **gsarr, int nelems);
91
92/* Functions adapted from geography_measurement.c */
93
94extern double gserialized_geog_length(GSERIALIZED *g, bool use_spheroid);
96 double tolerance, bool use_spheroid);
97extern double gserialized_geog_distance(const GSERIALIZED *g1,
98 const GSERIALIZED *g2);
99
100/* Functions adapted from geography_inout.c */
101
102extern GSERIALIZED *gserialized_geog_in(char *str, int32 geog_typmod);
103extern char *gserialized_geog_out(GSERIALIZED *g);
104
107
108/* Functions adapted from lwgeom_functions_analytic.c */
109
111 double distance_fraction, int repeat);
112extern GSERIALIZED *gserialized_line_substring(GSERIALIZED *geom, double from,
113 double to);
114
115/* Functions adapted from lwgeom_lrs.c */
116
117extern LWGEOM *lwgeom_line_interpolate_point(LWGEOM *lwgeom, double fraction,
118 int32_t srid, int repeat);
119extern double gserialized_line_locate_point(GSERIALIZED *geom1,
120 GSERIALIZED *geom2);
121
122/* Functions adapted from lwgeom_ogc.c */
123
125 int where);
126extern int gserialized_numpoints_linestring(const GSERIALIZED *geom);
127
128/*****************************************************************************/
129
130#endif /* __PGIS_CALL_H__ */
signed int int32
Definition: pg_ext_defs.in.h:8
GSERIALIZED * gserialized_pointn_linestring(const GSERIALIZED *geom, int where)
PointN(GEOMETRY,INTEGER) – find the first linestring in GEOMETRY,.
Definition: pgis_call.c:2152
double gserialized_3Ddistance(const GSERIALIZED *geom1, const GSERIALIZED *geom2)
Return the distance between two geometries.
Definition: pgis_call.c:515
GSERIALIZED * gserialized_boundary(const GSERIALIZED *geom1)
Return the boundary of a geometry.
Definition: pgis_call.c:425
bool gserialized_touches(const GSERIALIZED *geom1, const GSERIALIZED *geom2)
Return true if the geometries touch.
Definition: pgis_call.c:874
GSERIALIZED * gserialized_geog_from_geom(GSERIALIZED *geom)
Get a geography from a geometry.
Definition: pgis_call.c:1850
GSERIALIZED * gserialized_geom_from_geog(GSERIALIZED *g_ser)
Get a geometry from a geography.
Definition: pgis_call.c:1889
LWGEOM * box3d_to_lwgeom(BOX3D *box)
Create a geometry from a BOX3D.
Definition: pgis_call.c:156
GSERIALIZED * gserialized_array_union(GSERIALIZED **gsarr, int nelems)
This is the final function for GeomUnion aggregate.
Definition: pgis_call.c:975
char * gserialized_geog_out(GSERIALIZED *g)
Output a geography in string format.
Definition: pgis_call.c:1813
bool gserialized_dwithin(const GSERIALIZED *geom1, const GSERIALIZED *geom2, double tolerance)
Return true if the geometries are within the given distance.
Definition: pgis_call.c:552
GSERIALIZED * gserialized_geog_in(char *str, int32 geog_typmod)
Get a geography from in string.
Definition: pgis_call.c:1763
double gserialized_distance(const GSERIALIZED *geom1, const GSERIALIZED *geom2)
Return the distance between two geometries.
Definition: pgis_call.c:495
GSERIALIZED * gserialized_line_interpolate_point(GSERIALIZED *gser, double distance_fraction, int repeat)
Interpolate a point from a line.
Definition: pgis_call.c:1935
LWGEOM * box2d_to_lwgeom(GBOX *box, int srid)
MobilityDB functions gserialized_func(...) corresponding to external PostGIS functions XXX_func(PG_FU...
Definition: pgis_call.c:81
GSERIALIZED * gserialized_line_substring(GSERIALIZED *geom, double from, double to)
Get a subline from a line.
Definition: pgis_call.c:1971
double gserialized_line_locate_point(GSERIALIZED *geom1, GSERIALIZED *geom2)
Definition: pgis_call.c:2112
GSERIALIZED * gserialized_shortestline2d(const GSERIALIZED *geom1, const GSERIALIZED *geom2)
Return the shortest 2d line between two geometries.
Definition: pgis_call.c:453
bool gserialized_azimuth(GSERIALIZED *geom1, GSERIALIZED *geom2, double *result)
Compute the azimuth of segment defined by the two given Point geometries.
Definition: pgis_call.c:611
bool gserialized_inter_contains(const GSERIALIZED *geom1, const GSERIALIZED *geom2, bool inter)
Return true if the geometries intersect or the first contains the other.
Definition: pgis_call.c:826
GSERIALIZED * gserialized_reverse(const GSERIALIZED *geom)
Reverse vertex order of geometry.
Definition: pgis_call.c:597
LWGEOM * lwgeom_line_interpolate_point(LWGEOM *lwgeom, double fraction, int32_t srid, int repeat)
Get a geometry from a geography.
Definition: pgis_call.c:1915
double gserialized_geog_distance(const GSERIALIZED *g1, const GSERIALIZED *g2)
Return the distance between two geographies.
Definition: pgis_call.c:1170
double gserialized_geog_length(GSERIALIZED *g, bool use_spheroid)
Return double length in meters.
Definition: pgis_call.c:1079
bool gserialized_relate_pattern(const GSERIALIZED *geom1, const GSERIALIZED *geom2, char *patt)
Return true if the 3D geometries intersect.
Definition: pgis_call.c:907
GSERIALIZED * gserialized_shortestline3d(const GSERIALIZED *geom1, const GSERIALIZED *geom2)
Return the shortest line between two geometries in 3D.
Definition: pgis_call.c:474
bool gserialized_dwithin3d(const GSERIALIZED *geom1, const GSERIALIZED *geom2, double tolerance)
Return true if the geometries are within the given distance.
Definition: pgis_call.c:575
bool gserialized_geog_dwithin(GSERIALIZED *g1, GSERIALIZED *g2, double tolerance, bool use_spheroid)
Return true if the geographies are within the given distance.
Definition: pgis_call.c:1122
int gserialized_numpoints_linestring(const GSERIALIZED *geom)
numpoints(LINESTRING) – return the number of points in the linestring, or NULL if it is not a linestr...
Definition: pgis_call.c:2197
GSERIALIZED * gserialized_intersection(const GSERIALIZED *geom1, const GSERIALIZED *geom2)
Return true if the 3D geometries intersect.
Definition: pgis_call.c:951
bool gserialized_3Dintersects(const GSERIALIZED *geom1, const GSERIALIZED *geom2)
Return true if the 3D geometries intersect.
Definition: pgis_call.c:535
Definition: postgis_ext_defs.in.h:34
Definition: postgis_ext_defs.in.h:48
Definition: postgis_ext_defs.in.h:139
Definition: postgis_ext_defs.in.h:153