28 #include "utils/array.h"
29 #include "utils/builtins.h"
30 #include "utils/elog.h"
31 #include "utils/geo_decls.h"
33 #include "../postgis_config.h"
35 #include "lwgeom_pg.h"
42 #define xstr(s) str(s)
49 Datum
ST_Area(PG_FUNCTION_ARGS);
128 size_t size = VARSIZE(geom);
129 PG_FREE_IF_COPY(geom, 0);
130 PG_RETURN_INT32(size);
142 size_t result_sz = strlen(lwresult) + 8;
146 result =
lwalloc(result_sz + 2);
147 snprintf(result, result_sz,
"0:%s", lwresult);
152 snprintf(result, result_sz,
"%s", lwresult);
158 summary = cstring_to_text(result);
161 PG_FREE_IF_COPY(g, 0);
162 PG_RETURN_TEXT_P(summary);
168 char *ver = POSTGIS_VERSION;
169 text *result = cstring_to_text(ver);
170 PG_RETURN_TEXT_P(result);
177 text *result = cstring_to_text(ver);
178 PG_RETURN_TEXT_P(result);
185 text *result = cstring_to_text(ver);
186 PG_RETURN_TEXT_P(result);
198 static char *rev =
xstr(POSTGIS_REVISION);
200 if (rev && rev[0] !=
'\0')
202 snprintf(ver, 32,
"%s", rev);
204 PG_RETURN_TEXT_P(cstring_to_text(ver));
206 else PG_RETURN_NULL();
212 char *ver = POSTGIS_BUILD_DATE;
213 text *result = cstring_to_text(ver);
214 PG_RETURN_TEXT_P(result);
226 result = cstring_to_text(ver);
227 PG_RETURN_TEXT_P(result);
234 text *result = cstring_to_text(ver);
235 PG_RETURN_TEXT_P(result);
249 PG_FREE_IF_COPY(geom, 0);
250 PG_RETURN_INT32(npoints);
264 PG_FREE_IF_COPY(geom, 0);
265 PG_RETURN_INT32(nrings);
284 PG_FREE_IF_COPY(geom, 0);
286 PG_RETURN_FLOAT8(area);
303 PG_FREE_IF_COPY(geom, 0);
304 PG_RETURN_FLOAT8(dist);
321 PG_FREE_IF_COPY(geom, 0);
322 PG_RETURN_FLOAT8(dist);
337 double perimeter = 0.0;
340 PG_FREE_IF_COPY(geom, 0);
341 PG_RETURN_FLOAT8(perimeter);
356 double perimeter = 0.0;
359 PG_FREE_IF_COPY(geom, 0);
360 PG_RETURN_FLOAT8(perimeter);
367 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
373 PG_RETURN_POINTER(pg_geom_in);
381 PG_FREE_IF_COPY(pg_geom_in, 0);
382 PG_RETURN_POINTER(pg_geom_out);
389 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
395 PG_RETURN_POINTER(pg_geom_in);
403 PG_FREE_IF_COPY(pg_geom_in, 0);
404 PG_RETURN_POINTER(pg_geom_out);
411 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
417 PG_RETURN_POINTER(pg_geom_in);
425 PG_FREE_IF_COPY(pg_geom_in, 0);
426 PG_RETURN_POINTER(pg_geom_out);
433 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
439 PG_RETURN_POINTER(pg_geom_in);
447 PG_FREE_IF_COPY(pg_geom_in, 0);
448 PG_RETURN_POINTER(pg_geom_out);
462 POSTGIS_DEBUG(2,
"LWGEOM_force_collection called");
471 PG_RETURN_POINTER(geom);
491 lwgeoms = palloc(
sizeof(
LWGEOM *));
499 PG_FREE_IF_COPY(geom, 0);
500 PG_RETURN_POINTER(result);
512 POSTGIS_DEBUG(2,
"LWGEOM_force_multi called");
530 PG_RETURN_POINTER(geom);
542 PG_FREE_IF_COPY(geom, 0);
544 PG_RETURN_POINTER(result);
556 POSTGIS_DEBUG(2,
"LWGEOM_force_curve called");
565 PG_FREE_IF_COPY(geom, 0);
567 PG_RETURN_POINTER(result);
581 POSTGIS_DEBUG(2,
"LWGEOM_force_sfs called");
584 if ((PG_NARGS() > 1) && (!PG_ARGISNULL(1)))
586 ver = PG_GETARG_TEXT_P(1);
588 if (!strncmp(VARDATA(ver),
"1.2", 3))
599 PG_FREE_IF_COPY(geom, 0);
601 PG_RETURN_POINTER(result);
629 PG_FREE_IF_COPY(geom1, 0);
630 PG_FREE_IF_COPY(geom2, 1);
631 PG_RETURN_POINTER(result);
658 PG_FREE_IF_COPY(geom1, 0);
659 PG_FREE_IF_COPY(geom2, 1);
660 PG_RETURN_POINTER(result);
687 PG_FREE_IF_COPY(geom1, 0);
688 PG_FREE_IF_COPY(geom2, 1);
689 PG_RETURN_POINTER(result);
709 PG_FREE_IF_COPY(geom1, 0);
710 PG_FREE_IF_COPY(geom2, 1);
713 if (mindist < FLT_MAX)
714 PG_RETURN_FLOAT8(mindist);
730 double tolerance = PG_GETARG_FLOAT8(2);
736 elog(ERROR,
"Tolerance cannot be less than zero\n");
744 PG_FREE_IF_COPY(geom1, 0);
745 PG_FREE_IF_COPY(geom2, 1);
748 PG_RETURN_BOOL(tolerance >= mindist);
762 double tolerance = PG_GETARG_FLOAT8(2);
768 elog(ERROR,
"Tolerance cannot be less than zero\n");
776 PG_FREE_IF_COPY(geom1, 0);
777 PG_FREE_IF_COPY(geom2, 1);
781 PG_RETURN_BOOL(tolerance >= maxdist);
801 PG_FREE_IF_COPY(geom1, 0);
802 PG_FREE_IF_COPY(geom2, 1);
806 PG_RETURN_FLOAT8(maxdist);
838 PG_FREE_IF_COPY(geom1, 0);
839 PG_FREE_IF_COPY(geom2, 1);
840 PG_RETURN_POINTER(result);
869 PG_FREE_IF_COPY(geom1, 0);
870 PG_FREE_IF_COPY(geom2, 1);
871 PG_RETURN_POINTER(result);
900 PG_FREE_IF_COPY(geom1, 0);
901 PG_FREE_IF_COPY(geom2, 1);
902 PG_RETURN_POINTER(result);
919 PG_FREE_IF_COPY(geom1, 0);
920 PG_FREE_IF_COPY(geom2, 1);
923 if (mindist < FLT_MAX)
924 PG_RETURN_FLOAT8(mindist);
942 PG_FREE_IF_COPY(geom1, 0);
943 PG_FREE_IF_COPY(geom2, 1);
946 PG_RETURN_BOOL(0.0 == mindist);
961 double tolerance = PG_GETARG_FLOAT8(2);
967 elog(ERROR,
"Tolerance cannot be less than zero\n");
975 PG_FREE_IF_COPY(geom1, 0);
976 PG_FREE_IF_COPY(geom2, 1);
980 PG_RETURN_BOOL(tolerance >= mindist);
994 double tolerance = PG_GETARG_FLOAT8(2);
1000 elog(ERROR,
"Tolerance cannot be less than zero\n");
1007 PG_FREE_IF_COPY(geom1, 0);
1008 PG_FREE_IF_COPY(geom2, 1);
1012 PG_RETURN_BOOL(tolerance >= maxdist);
1033 PG_FREE_IF_COPY(geom1, 0);
1034 PG_FREE_IF_COPY(geom2, 1);
1038 PG_RETURN_FLOAT8(maxdist);
1050 POSTGIS_DEBUG(2,
"LWGEOM_longitude_shift called.");
1052 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
1070 PG_RETURN_POINTER(ret);
1078 LWGEOM *lwgeom_in, *lwgeom_out;
1083 POSTGIS_DEBUG(2,
"ST_WrapX called.");
1085 gdatum = PG_GETARG_DATUM(0);
1086 cutx = PG_GETARG_FLOAT8(1);
1087 amount = PG_GETARG_FLOAT8(2);
1091 geom_in = ((
GSERIALIZED *)PG_DETOAST_DATUM(gdatum));
1099 PG_FREE_IF_COPY(geom_in, 0);
1101 PG_RETURN_POINTER(geom_out);
1108 double cx = PG_GETARG_FLOAT8(1);
1109 double cy = PG_GETARG_FLOAT8(2);
1110 double rr = PG_GETARG_FLOAT8(3);
1115 geom = PG_GETARG_GSERIALIZED_P(0);
1120 PG_FREE_IF_COPY(geom, 0);
1127 PG_FREE_IF_COPY(geom, 0);
1128 PG_RETURN_BOOL(inside);
1142 LWGEOM *lwgeoms[2], *outlwg;
1143 uint32 type1, type2;
1147 POSTGIS_DEBUG(2,
"LWGEOM_collect called.");
1150 if (PG_ARGISNULL(0) && PG_ARGISNULL(1))
1154 if (PG_ARGISNULL(0))
1155 PG_RETURN_DATUM(PG_GETARG_DATUM(1));
1158 if (PG_ARGISNULL(1))
1159 PG_RETURN_DATUM(PG_GETARG_DATUM(0));
1161 gser1 = PG_GETARG_GSERIALIZED_P(0);
1162 gser2 = PG_GETARG_GSERIALIZED_P(1);
1166 "LWGEOM_collect(%s, %s): call",
1173 elog(ERROR,
"Cannot ST_Collect geometries with differing dimensionality.");
1182 type1 = lwgeoms[0]->
type;
1183 type2 = lwgeoms[1]->
type;
1190 POSTGIS_DEBUGF(3,
" outtype = %d", outtype);
1204 PG_FREE_IF_COPY(gser1, 0);
1205 PG_FREE_IF_COPY(gser2, 1);
1207 PG_RETURN_POINTER(result);
1226 LWGEOM **lwgeoms, *outlwg;
1232 ArrayIterator iterator;
1236 POSTGIS_DEBUG(2,
"LWGEOM_collect_garray called.");
1238 if (PG_ARGISNULL(0))
1242 array = PG_GETARG_ARRAYTYPE_P(0);
1243 nelems = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1246 " array is %d-bytes in size, %ld w/out header",
1248 ARR_SIZE(array) - ARR_OVERHEAD_NONULLS(ARR_NDIM(array)));
1250 POSTGIS_DEBUGF(3,
"LWGEOM_collect_garray: array has %d elements", nelems);
1260 lwgeoms = palloc(
sizeof(
LWGEOM *) * nelems);
1264 iterator = array_create_iterator(array, 0, NULL);
1266 while (array_iterate(iterator, &
value, &isnull))
1280 POSTGIS_DEBUGF(3,
"%s: geom %d deserialized", __func__,
count);
1288 if (lwgeoms[
count]->bbox)
1299 if (lwgeoms[
count]->bbox)
1326 array_free_iterator(iterator);
1328 POSTGIS_DEBUGF(3,
"LWGEOM_collect_garray: outtype = %d", outtype);
1341 PG_RETURN_POINTER(result);
1356 POSTGIS_DEBUG(2,
"LWGEOM_line_from_mpoint called");
1359 ingeom = PG_GETARG_GSERIALIZED_P(0);
1363 elog(ERROR,
"makeline: input must be a multipoint");
1371 PG_FREE_IF_COPY(ingeom, 0);
1372 elog(ERROR,
"makeline: lwline_from_lwmpoint returned NULL");
1378 PG_FREE_IF_COPY(ingeom, 0);
1381 PG_RETURN_POINTER(result);
1400 ArrayIterator iterator;
1404 POSTGIS_DEBUGF(2,
"%s called", __func__);
1407 if (PG_ARGISNULL(0))
1411 array = PG_GETARG_ARRAYTYPE_P(0);
1414 nelems = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1416 POSTGIS_DEBUGF(3,
"%s: array has %d elements", __func__, nelems);
1429 geoms = palloc(
sizeof(
LWGEOM *) * nelems);
1432 iterator = array_create_iterator(array, 0, NULL);
1434 while (array_iterate(iterator, &
value, &isnull))
1455 srid = geoms[ngeoms - 1]->
srid;
1461 POSTGIS_DEBUGF(3,
"%s: element %d deserialized", __func__, ngeoms);
1463 array_free_iterator(iterator);
1469 elog(NOTICE,
"No points or linestrings in input array");
1473 POSTGIS_DEBUGF(3,
"LWGEOM_makeline_garray: elements: %d", ngeoms);
1479 PG_RETURN_POINTER(result);
1494 POSTGIS_DEBUG(2,
"LWGEOM_makeline called.");
1497 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
1498 pglwg2 = PG_GETARG_GSERIALIZED_P(1);
1503 elog(ERROR,
"Input geometries must be points or lines");
1516 PG_FREE_IF_COPY(pglwg1, 0);
1517 PG_FREE_IF_COPY(pglwg2, 1);
1521 PG_RETURN_POINTER(result);
1532 ArrayType *array = NULL;
1534 const LWLINE *shell = NULL;
1535 const LWLINE **holes = NULL;
1541 POSTGIS_DEBUG(2,
"LWGEOM_makepoly called.");
1544 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
1547 lwpgerror(
"Shell is not a line");
1554 array = PG_GETARG_ARRAYTYPE_P(1);
1555 nholes = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1557 for (i = 0; i < nholes; i++)
1559 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
1560 #pragma GCC diagnostic push
1561 #pragma GCC diagnostic ignored "-Wsign-compare"
1564 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
1565 #pragma GCC diagnostic pop
1568 offset += INTALIGN(VARSIZE(g));
1571 lwpgerror(
"Hole %d is not a line", i);
1583 PG_FREE_IF_COPY(pglwg1, 0);
1585 for (i = 0; i < nholes; i++)
1590 PG_RETURN_POINTER(result);
1608 POSTGIS_DEBUG(2,
"LWGEOM_expand called.");
1614 PG_RETURN_POINTER(geom);
1621 PG_RETURN_POINTER(geom);
1624 if (PG_NARGS() == 2)
1627 double d = PG_GETARG_FLOAT8(1);
1632 double dx = PG_GETARG_FLOAT8(1);
1633 double dy = PG_GETARG_FLOAT8(2);
1634 double dz = PG_GETARG_FLOAT8(3);
1635 double dm = PG_GETARG_FLOAT8(4);
1657 PG_FREE_IF_COPY(geom, 0);
1659 PG_RETURN_POINTER(result);
1666 GSERIALIZED *pg_lwgeom = PG_GETARG_GSERIALIZED_P(0);
1680 PG_FREE_IF_COPY(pg_lwgeom, 0);
1687 out->low.x = gbox.
xmin;
1688 out->low.y = gbox.
ymin;
1689 out->high.x = gbox.
xmax;
1690 out->high.y = gbox.
ymax;
1691 PG_RETURN_POINTER(out);
1704 int32_t srid = lwgeom->
srid;
1713 PG_RETURN_POINTER(geom);
1719 PG_RETURN_POINTER(geom);
1789 PG_FREE_IF_COPY(geom, 0);
1791 PG_RETURN_POINTER(result);
1812 LWGEOM *inlwgeom, *outlwgeom;
1815 POSTGIS_DEBUG(2,
"LWGEOM_segmentize2d called");
1817 ingeom = PG_GETARG_GSERIALIZED_P(0);
1818 dist = PG_GETARG_FLOAT8(1);
1825 PG_RETURN_POINTER(ingeom);
1832 elog(ERROR,
"ST_Segmentize: invalid max_distance %g (must be >= 0)", dist);
1843 PG_RETURN_POINTER(ingeom);
1850 PG_FREE_IF_COPY(ingeom, 0);
1863 PG_FREE_IF_COPY(ingeom, 0);
1865 PG_RETURN_POINTER(outgeom);
1875 POSTGIS_DEBUG(2,
"LWGEOM_reverse called");
1877 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
1884 PG_RETURN_POINTER(geom);
1894 POSTGIS_DEBUG(2,
"LWGEOM_force_clockwise_poly called");
1896 ingeom = PG_GETARG_GSERIALIZED_P_COPY(0);
1904 PG_FREE_IF_COPY(ingeom, 0);
1905 PG_RETURN_POINTER(outgeom);
1916 PG_FREE_IF_COPY(in, 0);
1917 PG_RETURN_POINTER(out);
1925 LWGEOM *lwgeom_in, *lwgeom_out;
1927 POSTGIS_DEBUG(2,
"ST_Normalize called");
1929 in = PG_GETARG_GSERIALIZED_P_COPY(0);
1932 POSTGIS_DEBUGF(3,
"Deserialized: %s",
lwgeom_summary(lwgeom_in, 0));
1935 POSTGIS_DEBUGF(3,
"Normalized: %s",
lwgeom_summary(lwgeom_out, 0));
1941 PG_FREE_IF_COPY(in, 0);
1943 PG_RETURN_POINTER(out);
1963 PG_FREE_IF_COPY(in, 0);
1964 PG_RETURN_INT16(ret);
1986 PG_FREE_IF_COPY(in, 0);
1987 PG_RETURN_BOOL(
res);
1996 PG_FREE_IF_COPY(in, 0);
1997 PG_RETURN_INT16(ret);
2015 double x1, y1, x2, y2;
2018 POSTGIS_DEBUG(2,
"ST_MakeEnvelope called");
2020 x1 = PG_GETARG_FLOAT8(0);
2021 y1 = PG_GETARG_FLOAT8(1);
2022 x2 = PG_GETARG_FLOAT8(2);
2023 y2 = PG_GETARG_FLOAT8(3);
2026 srid = PG_GETARG_INT32(4);
2034 PG_RETURN_POINTER(result);
2044 uint32_t worldTileSize;
2045 double tileGeoSizeX, tileGeoSizeY;
2046 double boundsWidth, boundsHeight;
2047 double x1, y1, x2, y2;
2057 POSTGIS_DEBUG(2,
"ST_TileEnvelope called");
2059 zoom = PG_GETARG_INT32(0);
2060 x = PG_GETARG_INT32(1);
2061 y = PG_GETARG_INT32(2);
2063 bounds = PG_GETARG_GSERIALIZED_P(3);
2072 elog(ERROR,
"%s: Unable to compute bbox", __func__);
2076 boundsWidth = bbox.
xmax - bbox.
xmin;
2077 boundsHeight = bbox.
ymax - bbox.
ymin;
2078 if (boundsWidth <= 0 || boundsHeight <= 0)
2079 elog(ERROR,
"%s: Geometric bounds are too small", __func__);
2081 if (zoom < 0 || zoom >= 32)
2082 elog(ERROR,
"%s: Invalid tile zoom value, %d", __func__, zoom);
2084 zoomu = (uint32_t)zoom;
2085 worldTileSize = 0x01u << (zoomu > 31 ? 31 : zoomu);
2087 if (
x < 0 || (uint32_t)
x >= worldTileSize)
2088 elog(ERROR,
"%s: Invalid tile x value, %d", __func__,
x);
2089 if (
y < 0 || (uint32_t)
y >= worldTileSize)
2090 elog(ERROR,
"%s: Invalid tile y value, %d", __func__,
y);
2092 tileGeoSizeX = boundsWidth / worldTileSize;
2093 tileGeoSizeY = boundsHeight / worldTileSize;
2094 x1 = bbox.
xmin + tileGeoSizeX * (
x);
2095 x2 = bbox.
xmin + tileGeoSizeX * (
x+1);
2096 y1 = bbox.
ymax - tileGeoSizeY * (
y+1);
2097 y2 = bbox.
ymax - tileGeoSizeY * (
y);
2103 srid, x1, y1, x2, y2))));
2116 size = VARHDRSZ + 8 + 32 + 4;
2118 geom = PG_GETARG_GSERIALIZED_P_SLICE(0, 0, size);
2131 POSTGIS_DEBUG(2,
"LWGEOM_makepoint called");
2133 x = PG_GETARG_FLOAT8(0);
2134 y = PG_GETARG_FLOAT8(1);
2136 if (PG_NARGS() == 2)
2138 else if (PG_NARGS() == 3)
2140 z = PG_GETARG_FLOAT8(2);
2143 else if (PG_NARGS() == 4)
2145 z = PG_GETARG_FLOAT8(2);
2146 m = PG_GETARG_FLOAT8(3);
2151 elog(ERROR,
"LWGEOM_makepoint: unsupported number of args: %d", PG_NARGS());
2157 PG_RETURN_POINTER(result);
2167 POSTGIS_DEBUG(2,
"LWGEOM_makepoint3dm called.");
2169 x = PG_GETARG_FLOAT8(0);
2170 y = PG_GETARG_FLOAT8(1);
2171 m = PG_GETARG_FLOAT8(2);
2176 PG_RETURN_POINTER(result);
2185 uint32_t uwhere = 0;
2187 POSTGIS_DEBUGF(2,
"%s called.", __func__);
2189 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
2190 pglwg2 = PG_GETARG_GSERIALIZED_P(1);
2194 elog(ERROR,
"First argument must be a LINESTRING");
2200 elog(ERROR,
"Second argument must be a POINT");
2206 if (PG_NARGS() <= 2)
2212 int32 where = PG_GETARG_INT32(2);
2219 elog(ERROR,
"%s: Invalid offset", __func__);
2234 elog(ERROR,
"Point insert failed");
2241 PG_FREE_IF_COPY(pglwg1, 0);
2242 PG_FREE_IF_COPY(pglwg2, 1);
2245 PG_RETURN_POINTER(result);
2255 POSTGIS_DEBUG(2,
"LWGEOM_removepoint called.");
2257 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
2258 which = PG_GETARG_INT32(1);
2262 elog(ERROR,
"First argument must be a LINESTRING");
2268 if (which < 0 || (uint32_t)which > line->
points->
npoints - 1)
2270 elog(ERROR,
"Point index out of range (%u..%u)", 0, line->
points->
npoints - 1);
2276 elog(ERROR,
"Can't remove points from a single segment line");
2287 PG_FREE_IF_COPY(pglwg1, 0);
2288 PG_RETURN_POINTER(result);
2301 POSTGIS_DEBUG(2,
"LWGEOM_setpoint_linestring called.");
2304 pglwg1 = PG_GETARG_GSERIALIZED_P_COPY(0);
2306 which = PG_GETARG_INT32(1);
2307 pglwg2 = PG_GETARG_GSERIALIZED_P(2);
2314 elog(ERROR,
"Third argument must be a POINT");
2319 PG_FREE_IF_COPY(pglwg2, 2);
2326 elog(ERROR,
"First argument must be a LINESTRING");
2331 elog(ERROR,
"Line has no points");
2342 elog(ERROR,
"abs(Point index) out of range (-)(%u..%u)", 0, line->
points->
npoints - 1);
2356 PG_RETURN_POINTER(result);
2369 POSTGIS_DEBUG(2,
"LWGEOM_asEWKT called.");
2371 geom = PG_GETARG_GSERIALIZED_P(0);
2379 result = cstring_to_text(wkt);
2383 PG_FREE_IF_COPY(geom, 0);
2384 PG_RETURN_TEXT_P(result);
2403 geom = PG_GETARG_GSERIALIZED_P(0);
2407 PG_FREE_IF_COPY(geom, 0);
2408 lwpgerror(
"Argument must be POINT geometries");
2411 srid = lwpoint->
srid;
2414 PG_FREE_IF_COPY(geom, 0);
2415 lwpgerror(
"Error extracting point");
2419 PG_FREE_IF_COPY(geom, 0);
2422 geom = PG_GETARG_GSERIALIZED_P(1);
2426 PG_FREE_IF_COPY(geom, 1);
2427 lwpgerror(
"Argument must be POINT geometries");
2430 if (lwpoint->
srid != srid)
2432 PG_FREE_IF_COPY(geom, 1);
2433 lwpgerror(
"Operation on mixed SRID geometries");
2438 PG_FREE_IF_COPY(geom, 1);
2439 lwpgerror(
"Error extracting point");
2443 PG_FREE_IF_COPY(geom, 1);
2446 if ((p1.
x == p2.
x) && (p1.
y == p2.
y))
2457 PG_RETURN_FLOAT8(result);
2480 int n_args = PG_NARGS();
2483 for (i = 0; i < n_args; i++)
2485 seri_geoms[i] = PG_GETARG_GSERIALIZED_P(i);
2508 if (srids[0] != srids[i])
2520 for (j = 0; j <= i; j++)
2521 PG_FREE_IF_COPY(seri_geoms[j], j);
2524 lwpgerror(
"Empty geometry");
2529 lwpgerror(
"Argument must be POINT geometries");
2534 lwpgerror(
"Operation on mixed SRID geometries");
2539 for (i = 0; i < n_args; i++)
2545 for (j = 0; j < n_args; j++)
2546 PG_FREE_IF_COPY(seri_geoms[j], j);
2547 lwpgerror(
"Error unserializing geometry");
2556 lwpgerror(
"Error extracting point");
2583 result += (result < 0) * 2 * M_PI;
2584 PG_RETURN_FLOAT8(result);
2597 GSERIALIZED *pg_geom1 = PG_GETARG_GSERIALIZED_P(0);
2598 GSERIALIZED *pg_geom2 = PG_GETARG_GSERIALIZED_P(1);
2599 double dist = PG_GETARG_FLOAT8(2);
2608 elog(ERROR,
"optimistic_overlap: first arg isn't a polygon\n");
2614 elog(ERROR,
"optimistic_overlap: 2nd arg isn't a [multi-]polygon\n");
2621 g1_bvol.
xmin = g1_bvol.
xmin - dist;
2622 g1_bvol.
ymin = g1_bvol.
ymin - dist;
2623 g1_bvol.
xmax = g1_bvol.
xmax + dist;
2624 g1_bvol.
ymax = g1_bvol.
ymax + dist;
2629 PG_RETURN_BOOL(
false);
2637 DatumGetFloat8(DirectFunctionCall2(
ST_Distance, PointerGetDatum(pg_geom1), PointerGetDatum(pg_geom2)));
2639 PG_RETURN_BOOL(calc_dist < dist);
2646 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P_COPY(0);
2651 affine.
afac = PG_GETARG_FLOAT8(1);
2652 affine.
bfac = PG_GETARG_FLOAT8(2);
2653 affine.
cfac = PG_GETARG_FLOAT8(3);
2654 affine.
dfac = PG_GETARG_FLOAT8(4);
2655 affine.
efac = PG_GETARG_FLOAT8(5);
2656 affine.
ffac = PG_GETARG_FLOAT8(6);
2657 affine.
gfac = PG_GETARG_FLOAT8(7);
2658 affine.
hfac = PG_GETARG_FLOAT8(8);
2659 affine.
ifac = PG_GETARG_FLOAT8(9);
2660 affine.
xoff = PG_GETARG_FLOAT8(10);
2661 affine.
yoff = PG_GETARG_FLOAT8(11);
2662 affine.
zoff = PG_GETARG_FLOAT8(12);
2664 POSTGIS_DEBUG(2,
"LWGEOM_affine called.");
2677 PG_FREE_IF_COPY(geom, 0);
2679 PG_RETURN_POINTER(ret);
2688 char *geohash = NULL;
2689 text *result = NULL;
2691 if (PG_ARGISNULL(0))
2696 geom = PG_GETARG_GSERIALIZED_P(0);
2698 if (!PG_ARGISNULL(1))
2708 result = cstring_to_text(geohash);
2711 PG_RETURN_TEXT_P(result);
2721 int type = PG_GETARG_INT32(1);
2722 int lwgeom_type = lwgeom->
type;
2728 elog(ERROR,
"ST_CollectionExtract: only point, linestring and polygon may be extracted");
2736 if (lwgeom_type ==
type)
2739 PG_RETURN_POINTER(input);
2757 PG_RETURN_POINTER(output);
2773 PG_FREE_IF_COPY(input, 0);
2780 PG_FREE_IF_COPY(input, 0);
2781 PG_RETURN_POINTER(output);
2788 GSERIALIZED *g_in = PG_GETARG_GSERIALIZED_P_COPY(0);
2791 LWGEOM *lwgeom_in = NULL;
2792 double tolerance = 0.0;
2797 PG_RETURN_POINTER(g_in);
2799 if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
2800 tolerance = PG_GETARG_FLOAT8(1);
2807 PG_RETURN_POINTER(g_in);
2813 PG_RETURN_POINTER(g_out);
2820 GSERIALIZED *in = PG_GETARG_GSERIALIZED_P_COPY(0);
2828 PG_FREE_IF_COPY(in, 0);
2830 PG_RETURN_POINTER(out);
2836 if (n ==
'x' || n ==
'X')
2838 if (n ==
'y' || n ==
'Y')
2840 if (n ==
'z' || n ==
'Z')
2842 if (n ==
'm' || n ==
'M')
2844 lwpgerror(
"Invalid ordinate name '%c'. Expected x,y,z or m", n);
2858 ospec = PG_GETARG_CSTRING(1);
2859 if (strlen(ospec) != 2)
2862 "Invalid ordinate specification. "
2863 "Need two letters from the set (x,y,z,m). "
2871 in = PG_GETARG_GSERIALIZED_P_COPY(0);
2876 lwpgerror(
"Geometry does not have an M ordinate");
2881 lwpgerror(
"Geometry does not have a Z ordinate");
2887 PG_RETURN_POINTER(in);
2893 PG_FREE_IF_COPY(in, 0);
2894 PG_RETURN_POINTER(out);
2904 GSERIALIZED *geom_in = PG_GETARG_GSERIALIZED_P(0);
2906 bool fits = PG_GETARG_BOOL(1);
2912 int32_t srid = lwgeom_in->
srid;
2919 lwgeom_in->
bbox = NULL;
2945 PG_FREE_IF_COPY(geom_in, 0);
2950 PG_RETURN_POINTER(geom_out);
2958 GSERIALIZED *geom_scale = PG_GETARG_GSERIALIZED_P(1);
2960 LWGEOM *lwg, *lwg_scale, *lwg_origin;
2961 LWPOINT *lwpt_scale, *lwpt_origin;
2964 bool translate =
false;
2974 PG_FREE_IF_COPY(geom_scale, 1);
2975 lwpgerror(
"Scale factor geometry parameter must be a point");
2980 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
2988 PG_FREE_IF_COPY(geom_scale, 1);
2989 PG_RETURN_POINTER(geom);
3002 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
3004 geom_origin = PG_GETARG_GSERIALIZED_P(2);
3014 PG_FREE_IF_COPY(geom_origin, 2);
3021 memset(&aff, 0,
sizeof(
AFFINE));
3025 aff.
xoff = -1 * origin.
x;
3026 aff.
yoff = -1 * origin.
y;
3027 aff.
zoff = -1 * origin.
z;
3045 PG_FREE_IF_COPY(geom, 0);
3046 PG_FREE_IF_COPY(geom_scale, 1);
3047 PG_RETURN_POINTER(ret);
3054 if (PG_ARGISNULL(0))
3069 PG_RETURN_POINTER(ret);
3084 if (PG_ARGISNULL(0))
3086 if (PG_ARGISNULL(1))
3088 lwpgerror(
"Must specify precision");
3093 prec_x = PG_GETARG_INT32(1);
3095 prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3096 prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3097 prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3099 input = PG_GETARG_GSERIALIZED_P_COPY(0);
3107 PG_FREE_IF_COPY(input, 0);
3108 PG_RETURN_POINTER(result);
3125 if (PG_NARGS() > 0 && !PG_ARGISNULL(0))
3127 geom_in = PG_GETARG_GSERIALIZED_P(0);
3134 if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
3135 min = PG_GETARG_FLOAT8(1);
3140 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
3141 max = PG_GETARG_FLOAT8(2);
3146 if (PG_NARGS() > 3 && !PG_ARGISNULL(3) && PG_GETARG_BOOL(3))
3155 elog(ERROR,
"Min-value cannot be larger than Max value\n");
3165 elog(NOTICE,
"No M-value, No vertex removed\n");
3166 PG_RETURN_POINTER(geom_in);
3173 PG_RETURN_POINTER(geom_out);
int gbox_merge(const GBOX *new_box, GBOX *merge_box)
Update the merged GBOX to be large enough to include itself and the new box.
void gbox_expand(GBOX *g, double d)
Move the box minimums down and the maximums up by the distance provided.
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
void gbox_expand_xyzm(GBOX *g, double dx, double dy, double dz, double dm)
Move the box minimums down and the maximums up by the distances provided.
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
void gserialized_error_if_srid_mismatch(const GSERIALIZED *g1, const GSERIALIZED *g2, const char *funcname)
void gserialized_error_if_srid_mismatch_reference(const GSERIALIZED *g1, const int32_t srid2, const char *funcname)
int gserialized_has_bbox(const GSERIALIZED *g)
Check if a GSERIALIZED has a bounding box without deserializing first.
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
int gserialized_ndims(const GSERIALIZED *g)
Return the number of dimensions (2, 3, 4) in a geometry.
uint32_t gserialized_get_version(const GSERIALIZED *g)
Return the serialization version.
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Read the box from the GSERIALIZED or calculate it if necessary.
int gserialized_has_m(const GSERIALIZED *g)
Check if a GSERIALIZED has an M ordinate.
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
int gserialized_has_z(const GSERIALIZED *g)
Check if a GSERIALIZED has a Z ordinate.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
int gserialized_cmp(const GSERIALIZED *g1, const GSERIALIZED *g2)
Return -1 if g1 is "less than" g2, 1 if g1 is "greater than" g2 and 0 if g1 and g2 are the "same".
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
int lwpoint_getPoint4d_p(const LWPOINT *point, POINT4D *out)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
uint32_t lwtype_get_collectiontype(uint8_t type)
Given an lwtype number, what homogeneous collection can hold it?
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
LWPOINT * lwpoint_make4d(int32_t srid, double x, double y, double z, double m)
LWGEOM * lwgeom_closest_point(const LWGEOM *lw1, const LWGEOM *lw2)
double lwgeom_maxdistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing max distance calculation.
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
void lwmpoint_free(LWMPOINT *mpt)
LWGEOM * lwgeom_force_4d(const LWGEOM *geom)
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
void lwgeom_set_srid(LWGEOM *geom, int32_t srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
void lwgeom_trim_bits_in_place(LWGEOM *geom, int32_t prec_x, int32_t prec_y, int32_t prec_z, int32_t prec_m)
Trim the bits of an LWGEOM in place, to optimize it for compression.
void lwpoint_free(LWPOINT *pt)
void lwgeom_longitude_shift(LWGEOM *lwgeom)
void lwgeom_free(LWGEOM *geom)
double lwgeom_maxdistance3d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling 3d max distance calculations and dfullywithin calculations.
LWGEOM * lwgeom_filter_m(LWGEOM *geom, double min, double max, int returnm)
LWPOINT * lwpoint_make3dm(int32_t srid, double x, double y, double m)
LWGEOM * lwgeom_as_multi(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate MULTI* type.
double lwgeom_perimeter_2d(const LWGEOM *geom)
int lwpoint_inside_circle(const LWPOINT *p, double cx, double cy, double rad)
LWGEOM * lwgeom_segmentize2d(const LWGEOM *line, double dist)
LWGEOM * lwgeom_furthest_line_3d(LWGEOM *lw1, LWGEOM *lw2)
LWGEOM * lwgeom_closest_point_3d(const LWGEOM *lw1, const LWGEOM *lw2)
LWGEOM * lwmpoint_as_lwgeom(const LWMPOINT *obj)
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
LWGEOM * lwgeom_force_sfs(LWGEOM *geom, int version)
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
int lwgeom_remove_repeated_points_in_place(LWGEOM *in, double tolerance)
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
double lwgeom_length(const LWGEOM *geom)
const char * lwgeom_version(void)
Return lwgeom version string (not to be freed)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
int lwtype_is_collection(uint8_t type)
Determine whether a type number is a collection or not.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
#define FLAGS_GET_Z(flags)
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
void lwgeom_scale(LWGEOM *geom, const POINT4D *factors)
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
LWPOLY * lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D *p4)
double lwgeom_area(const LWGEOM *geom)
LWPOLY * lwpoly_construct_envelope(int32_t srid, double x1, double y1, double x2, double y2)
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
char * lwgeom_geohash(const LWGEOM *lwgeom, int precision)
Calculate the GeoHash (http://geohash.org) string for a geometry.
LWGEOM * lwgeom_homogenize(const LWGEOM *geom)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
LWGEOM * lwgeom_as_curve(const LWGEOM *lwgeom)
Create a new LWGEOM of the appropriate CURVE* type.
LWGEOM * lwgeom_normalize(const LWGEOM *geom)
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
LWPOINT * lwpoint_make3dz(int32_t srid, double x, double y, double z)
double lwgeom_mindistance3d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling 3d min distance calculations and dwithin calculations.
void lwgeom_swap_ordinates(LWGEOM *in, LWORD o1, LWORD o2)
Swap ordinate values in every vertex of the geometry.
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
LWGEOM * lwgeom_closest_line(const LWGEOM *lw1, const LWGEOM *lw2)
#define POLYHEDRALSURFACETYPE
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
double lwgeom_length_2d(const LWGEOM *geom)
uint32_t lwgeom_count_rings(const LWGEOM *geom)
Count the total number of rings in any LWGEOM.
double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing min distance calculation.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
#define FLAGS_GET_M(flags)
void lwgeom_force_clockwise(LWGEOM *lwgeom)
Force Right-hand-rule on LWGEOM polygons.
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
LWLINE * lwline_from_lwmpoint(int32_t srid, const LWMPOINT *mpoint)
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
LWGEOM * lwgeom_force_3dm(const LWGEOM *geom)
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
void lwline_setPoint4d(LWLINE *line, uint32_t which, POINT4D *newpoint)
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
LWMPOINT * lwmpoint_from_lwgeom(const LWGEOM *g)
LWCOLLECTION * lwcollection_extract(LWCOLLECTION *col, int type)
Takes a potentially heterogeneous collection and returns a homogeneous collection consisting only of ...
LWGEOM * lwgeom_furthest_line(const LWGEOM *lw1, const LWGEOM *lw2)
void * lwalloc(size_t size)
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
double lwgeom_maxdistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling max distance calculations and dfullywithin calculations.
LWGEOM * lwgeom_wrapx(const LWGEOM *lwgeom, double cutx, double amount)
wrap geometry on given cut x value
void lwpoly_free(LWPOLY *poly)
#define LW_TRUE
Return types for functions with status returns.
double lwgeom_maxdistance3d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing 3d max distance calculation.
#define SRID_UNKNOWN
Unknown SRID value.
double lwgeom_perimeter(const LWGEOM *geom)
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
LWPOLY * lwpoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
LWGEOM * lwgeom_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
LWGEOM * lwgeom_force_3dz(const LWGEOM *geom)
LWLINE * lwline_removepoint(LWLINE *line, uint32_t which)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
void lwline_free(LWLINE *line)
LWLINE * lwline_from_lwgeom_array(int32_t srid, uint32_t ngeoms, LWGEOM **geoms)
LWGEOM * lwgeom_closest_line_3d(const LWGEOM *lw1, const LWGEOM *lw2)
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
int lwline_add_lwpoint(LWLINE *line, LWPOINT *point, uint32_t where)
Add a LWPOINT to an LWLINE.
void lwgeom_drop_srid(LWGEOM *lwgeom)
void lwgeom_reverse_in_place(LWGEOM *lwgeom)
Reverse vertex order of LWGEOM.
double lwgeom_mindistance3d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing 3d min distance calculation.
enum LWORD_T LWORD
Ordinate names.
This library is the generic geometry handling section of PostGIS.
Datum LWGEOM_FilterByM(PG_FUNCTION_ARGS)
Datum LWGEOM_isempty(PG_FUNCTION_ARGS)
Datum LWGEOM_perimeter2d_poly(PG_FUNCTION_ARGS)
Datum LWGEOM_force_3dm(PG_FUNCTION_ARGS)
Datum LWGEOM_force_2d(PG_FUNCTION_ARGS)
Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
Datum LWGEOM_makepoint(PG_FUNCTION_ARGS)
Datum ST_3DIntersects(PG_FUNCTION_ARGS)
Datum LWGEOM_force_3dz(PG_FUNCTION_ARGS)
Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
Datum LWGEOM_segmentize2d(PG_FUNCTION_ARGS)
Datum LWGEOM_dfullywithin3d(PG_FUNCTION_ARGS)
Datum ST_Area(PG_FUNCTION_ARGS)
Datum ST_CollectionHomogenize(PG_FUNCTION_ARGS)
Datum LWGEOM_shortestline3d(PG_FUNCTION_ARGS)
Datum postgis_lib_revision(PG_FUNCTION_ARGS)
Datum LWGEOM_maxdistance2d_linestring(PG_FUNCTION_ARGS)
Datum LWGEOM_dfullywithin(PG_FUNCTION_ARGS)
Datum LWGEOM_removepoint(PG_FUNCTION_ARGS)
Datum LWGEOM_noop(PG_FUNCTION_ARGS)
Datum postgis_scripts_released(PG_FUNCTION_ARGS)
Datum LWGEOM_affine(PG_FUNCTION_ARGS)
Datum ST_RemoveRepeatedPoints(PG_FUNCTION_ARGS)
Datum ST_BoundingDiagonal(PG_FUNCTION_ARGS)
Datum LWGEOM_longitude_shift(PG_FUNCTION_ARGS)
Datum ST_QuantizeCoordinates(PG_FUNCTION_ARGS)
Datum postgis_version(PG_FUNCTION_ARGS)
Datum postgis_liblwgeom_version(PG_FUNCTION_ARGS)
Datum LWGEOM_force_4d(PG_FUNCTION_ARGS)
Datum LWGEOM_nrings(PG_FUNCTION_ARGS)
Datum ST_Points(PG_FUNCTION_ARGS)
Datum LWGEOM_zmflag(PG_FUNCTION_ARGS)
Datum ST_GeoHash(PG_FUNCTION_ARGS)
Datum ST_TileEnvelope(PG_FUNCTION_ARGS)
Datum ST_IsCollection(PG_FUNCTION_ARGS)
Datum ST_3DDistance(PG_FUNCTION_ARGS)
Datum LWGEOM_mem_size(PG_FUNCTION_ARGS)
Datum postgis_svn_version(PG_FUNCTION_ARGS)
Datum LWGEOM_makeline(PG_FUNCTION_ARGS)
Datum LWGEOM_ndims(PG_FUNCTION_ARGS)
Datum ST_Scale(PG_FUNCTION_ARGS)
Datum LWGEOM_force_curve(PG_FUNCTION_ARGS)
Datum LWGEOM_setpoint_linestring(PG_FUNCTION_ARGS)
Datum LWGEOM_dwithin3d(PG_FUNCTION_ARGS)
Datum LWGEOM_shortestline2d(PG_FUNCTION_ARGS)
Datum LWGEOM_perimeter_poly(PG_FUNCTION_ARGS)
Datum LWGEOM_envelope(PG_FUNCTION_ARGS)
Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
Datum ST_MakeEnvelope(PG_FUNCTION_ARGS)
Datum LWGEOM_force_clockwise_poly(PG_FUNCTION_ARGS)
Datum LWGEOM_hasm(PG_FUNCTION_ARGS)
Datum LWGEOM_to_BOX(PG_FUNCTION_ARGS)
Datum LWGEOM_azimuth(PG_FUNCTION_ARGS)
Datum ST_Normalize(PG_FUNCTION_ARGS)
Datum optimistic_overlap(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(LWGEOM_mem_size)
find the size of geometry
Datum ST_CollectionExtract(PG_FUNCTION_ARGS)
Datum LWGEOM_asEWKT(PG_FUNCTION_ARGS)
Datum LWGEOM_angle(PG_FUNCTION_ARGS)
Datum LWGEOM_inside_circle_point(PG_FUNCTION_ARGS)
Datum postgis_lib_build_date(PG_FUNCTION_ARGS)
Datum LWGEOM_line_from_mpoint(PG_FUNCTION_ARGS)
Datum LWGEOM_collect(PG_FUNCTION_ARGS)
Datum LWGEOM_collect_garray(PG_FUNCTION_ARGS)
Datum LWGEOM_hasBBOX(PG_FUNCTION_ARGS)
Datum LWGEOM_same(PG_FUNCTION_ARGS)
Datum ST_SwapOrdinates(PG_FUNCTION_ARGS)
Datum LWGEOM_reverse(PG_FUNCTION_ARGS)
Datum LWGEOM_hasz(PG_FUNCTION_ARGS)
Datum postgis_lib_version(PG_FUNCTION_ARGS)
Datum LWGEOM_addpoint(PG_FUNCTION_ARGS)
Datum LWGEOM_longestline2d(PG_FUNCTION_ARGS)
Datum LWGEOM_makeline_garray(PG_FUNCTION_ARGS)
Datum LWGEOM_force_sfs(PG_FUNCTION_ARGS)
Datum LWGEOM_length2d_linestring(PG_FUNCTION_ARGS)
Datum ST_FlipCoordinates(PG_FUNCTION_ARGS)
Datum LWGEOM_closestpoint(PG_FUNCTION_ARGS)
Datum LWGEOM_expand(PG_FUNCTION_ARGS)
Datum ST_Distance(PG_FUNCTION_ARGS)
Datum LWGEOM_longestline3d(PG_FUNCTION_ARGS)
Datum LWGEOM_length_linestring(PG_FUNCTION_ARGS)
static LWORD ordname2ordval(char n)
Datum LWGEOM_npoints(PG_FUNCTION_ARGS)
Datum ST_WrapX(PG_FUNCTION_ARGS)
Datum LWGEOM_makepoint3dm(PG_FUNCTION_ARGS)
Datum LWGEOM_dwithin(PG_FUNCTION_ARGS)
Datum LWGEOM_mindistance3d(PG_FUNCTION_ARGS)
Datum postgis_libxml_version(PG_FUNCTION_ARGS)
Datum LWGEOM_maxdistance3d(PG_FUNCTION_ARGS)
Datum LWGEOM_closestpoint3d(PG_FUNCTION_ARGS)
Datum LWGEOM_summary(PG_FUNCTION_ARGS)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
#define POSTGIS_LIB_VERSION
#define POSTGIS_LIBXML2_VERSION