29 #include "utils/array.h"
30 #include "utils/builtins.h"
31 #include "utils/elog.h"
32 #include "utils/geo_decls.h"
34 #include "../postgis_config.h"
36 #include "lwgeom_pg.h"
127 size_t size = VARSIZE(geom);
128 PG_FREE_IF_COPY(geom,0);
129 PG_RETURN_INT32(size);
146 mytext = cstring_to_text(result);
149 PG_FREE_IF_COPY(geom,0);
150 PG_RETURN_TEXT_P(mytext);
156 char *ver = POSTGIS_VERSION;
157 text *result = cstring_to_text(ver);
158 PG_RETURN_TEXT_P(result);
165 text *result = cstring_to_text(ver);
166 PG_RETURN_TEXT_P(result);
173 text *result = cstring_to_text(ver);
174 PG_RETURN_TEXT_P(result);
180 static int rev = POSTGIS_SVN_REVISION;
184 snprintf(ver, 32,
"%d", rev);
185 PG_RETURN_TEXT_P(cstring_to_text(ver));
194 char *ver = POSTGIS_BUILD_DATE;
195 text *result = cstring_to_text(ver);
196 PG_RETURN_TEXT_P(result);
208 result = cstring_to_text(ver);
209 PG_RETURN_TEXT_P(result);
215 PG_RETURN_BOOL(
true);
221 #ifdef POSTGIS_AUTOCACHE_BBOX
222 PG_RETURN_BOOL(
true);
224 PG_RETURN_BOOL(
false);
233 text *result = cstring_to_text(ver);
234 PG_RETURN_TEXT_P(result);
248 PG_FREE_IF_COPY(geom, 0);
249 PG_RETURN_INT32(npoints);
263 PG_FREE_IF_COPY(geom, 0);
264 PG_RETURN_INT32(nrings);
280 POSTGIS_DEBUG(2,
"in LWGEOM_area_polygon");
285 PG_FREE_IF_COPY(geom, 0);
287 PG_RETURN_FLOAT8(
area);
304 PG_FREE_IF_COPY(geom, 0);
305 PG_RETURN_FLOAT8(dist);
322 PG_FREE_IF_COPY(geom, 0);
323 PG_RETURN_FLOAT8(dist);
338 double perimeter = 0.0;
341 PG_FREE_IF_COPY(geom, 0);
342 PG_RETURN_FLOAT8(perimeter);
357 double perimeter = 0.0;
360 PG_FREE_IF_COPY(geom, 0);
361 PG_RETURN_FLOAT8(perimeter);
369 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
382 PG_FREE_IF_COPY(pg_geom_in, 0);
383 PG_RETURN_POINTER(pg_geom_out);
390 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
396 PG_RETURN_POINTER(pg_geom_in);
404 PG_FREE_IF_COPY(pg_geom_in, 0);
405 PG_RETURN_POINTER(pg_geom_out);
412 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
418 PG_RETURN_POINTER(pg_geom_in);
426 PG_FREE_IF_COPY(pg_geom_in, 0);
427 PG_RETURN_POINTER(pg_geom_out);
434 GSERIALIZED *pg_geom_in = PG_GETARG_GSERIALIZED_P(0);
440 PG_RETURN_POINTER(pg_geom_in);
448 PG_FREE_IF_COPY(pg_geom_in, 0);
449 PG_RETURN_POINTER(pg_geom_out);
463 POSTGIS_DEBUG(2,
"LWGEOM_force_collection called");
473 PG_RETURN_POINTER(geom);
493 lwgeoms = palloc(
sizeof(
LWGEOM*));
503 PG_FREE_IF_COPY(geom, 0);
504 PG_RETURN_POINTER(result);
516 POSTGIS_DEBUG(2,
"LWGEOM_force_multi called");
533 PG_RETURN_POINTER(geom);
545 PG_FREE_IF_COPY(geom, 0);
547 PG_RETURN_POINTER(result);
559 POSTGIS_DEBUG(2,
"LWGEOM_force_curve called");
568 PG_FREE_IF_COPY(geom, 0);
570 PG_RETURN_POINTER(result);
584 POSTGIS_DEBUG(2,
"LWGEOM_force_sfs called");
587 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
589 ver = PG_GETARG_TEXT_P(1);
591 if ( ! strncmp(VARDATA(ver),
"1.2", 3))
602 PG_FREE_IF_COPY(geom, 0);
604 PG_RETURN_POINTER(result);
633 PG_FREE_IF_COPY(geom1, 0);
634 PG_FREE_IF_COPY(geom2, 1);
635 PG_RETURN_POINTER(result);
663 PG_FREE_IF_COPY(geom1, 0);
664 PG_FREE_IF_COPY(geom2, 1);
665 PG_RETURN_POINTER(result);
693 PG_FREE_IF_COPY(geom1, 0);
694 PG_FREE_IF_COPY(geom2, 1);
695 PG_RETURN_POINTER(result);
716 PG_FREE_IF_COPY(geom1, 0);
717 PG_FREE_IF_COPY(geom2, 1);
721 PG_RETURN_FLOAT8(mindist);
737 double tolerance = PG_GETARG_FLOAT8(2);
743 elog(ERROR,
"Tolerance cannot be less than zero\n");
751 PG_FREE_IF_COPY(geom1, 0);
752 PG_FREE_IF_COPY(geom2, 1);
755 PG_RETURN_BOOL(tolerance >= mindist);
769 double tolerance = PG_GETARG_FLOAT8(2);
775 elog(ERROR,
"Tolerance cannot be less than zero\n");
783 PG_FREE_IF_COPY(geom1, 0);
784 PG_FREE_IF_COPY(geom2, 1);
788 PG_RETURN_BOOL(tolerance >= maxdist);
809 PG_FREE_IF_COPY(geom1, 0);
810 PG_FREE_IF_COPY(geom2, 1);
814 PG_RETURN_FLOAT8(maxdist);
847 PG_FREE_IF_COPY(geom1, 0);
848 PG_FREE_IF_COPY(geom2, 1);
849 PG_RETURN_POINTER(result);
879 PG_FREE_IF_COPY(geom1, 0);
880 PG_FREE_IF_COPY(geom2, 1);
881 PG_RETURN_POINTER(result);
911 PG_FREE_IF_COPY(geom1, 0);
912 PG_FREE_IF_COPY(geom2, 1);
913 PG_RETURN_POINTER(result);
931 PG_FREE_IF_COPY(geom1, 0);
932 PG_FREE_IF_COPY(geom2, 1);
936 PG_RETURN_FLOAT8(mindist);
952 double tolerance = PG_GETARG_FLOAT8(2);
958 elog(ERROR,
"Tolerance cannot be less than zero\n");
966 PG_FREE_IF_COPY(geom1, 0);
967 PG_FREE_IF_COPY(geom2, 1);
971 PG_RETURN_BOOL(tolerance >= mindist);
985 double tolerance = PG_GETARG_FLOAT8(2);
991 elog(ERROR,
"Tolerance cannot be less than zero\n");
998 PG_FREE_IF_COPY(geom1, 0);
999 PG_FREE_IF_COPY(geom2, 1);
1003 PG_RETURN_BOOL(tolerance >= maxdist);
1024 PG_FREE_IF_COPY(geom1, 0);
1025 PG_FREE_IF_COPY(geom2, 1);
1029 PG_RETURN_FLOAT8(maxdist);
1042 POSTGIS_DEBUG(2,
"LWGEOM_longitude_shift called.");
1044 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
1062 PG_RETURN_POINTER(ret);
1070 LWGEOM *lwgeom_in, *lwgeom_out;
1075 POSTGIS_DEBUG(2,
"ST_WrapX called.");
1077 gdatum = PG_GETARG_DATUM(0);
1078 cutx = PG_GETARG_FLOAT8(1);
1079 amount = PG_GETARG_FLOAT8(2);
1083 geom_in = ((
GSERIALIZED *)PG_DETOAST_DATUM(gdatum));
1091 PG_FREE_IF_COPY(geom_in, 0);
1093 PG_RETURN_POINTER(geom_out);
1100 double cx = PG_GETARG_FLOAT8(1);
1101 double cy = PG_GETARG_FLOAT8(2);
1102 double rr = PG_GETARG_FLOAT8(3);
1107 geom = PG_GETARG_GSERIALIZED_P(0);
1112 PG_FREE_IF_COPY(geom, 0);
1119 PG_FREE_IF_COPY(geom, 0);
1120 PG_RETURN_BOOL(inside);
1134 LWGEOM *lwgeoms[2], *outlwg;
1135 uint32 type1, type2;
1139 POSTGIS_DEBUG(2,
"LWGEOM_collect called.");
1142 if ( PG_ARGISNULL(0) && PG_ARGISNULL(1) )
1146 if (PG_ARGISNULL(0))
1147 PG_RETURN_DATUM(PG_GETARG_DATUM(1));
1150 if (PG_ARGISNULL(1))
1151 PG_RETURN_DATUM(PG_GETARG_DATUM(0));
1153 gser1 = PG_GETARG_GSERIALIZED_P(0);
1154 gser2 = PG_GETARG_GSERIALIZED_P(1);
1160 elog(ERROR,
"Cannot ST_Collect geometries with differing dimensionality.");
1170 type1 = lwgeoms[0]->
type;
1171 type2 = lwgeoms[1]->
type;
1178 POSTGIS_DEBUGF(3,
" outtype = %d", outtype);
1192 PG_FREE_IF_COPY(gser1, 0);
1193 PG_FREE_IF_COPY(gser2, 1);
1195 PG_RETURN_POINTER(result);
1215 LWGEOM **lwgeoms, *outlwg;
1221 ArrayIterator iterator;
1225 POSTGIS_DEBUG(2,
"LWGEOM_collect_garray called.");
1227 if ( PG_ARGISNULL(0) )
1231 array = PG_GETARG_ARRAYTYPE_P(0);
1232 nelems = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1234 POSTGIS_DEBUGF(3,
" array is %d-bytes in size, %ld w/out header",
1235 ARR_SIZE(array), ARR_SIZE(array)-ARR_OVERHEAD_NONULLS(ARR_NDIM(array)));
1237 POSTGIS_DEBUGF(3,
"LWGEOM_collect_garray: array has %d elements", nelems);
1247 lwgeoms = palloc(
sizeof(
LWGEOM*) * nelems);
1251 #if POSTGIS_PGSQL_VERSION >= 95
1252 iterator = array_create_iterator(array, 0, NULL);
1254 iterator = array_create_iterator(array, 0);
1257 while( array_iterate(iterator, &
value, &isnull) )
1271 POSTGIS_DEBUGF(3,
"%s: geom %d deserialized", __func__,
count);
1279 if ( lwgeoms[
count]->bbox )
1292 if ( lwgeoms[
count]->bbox )
1322 array_free_iterator(iterator);
1325 POSTGIS_DEBUGF(3,
"LWGEOM_collect_garray: outtype = %d", outtype);
1336 box,
count, lwgeoms);
1340 PG_RETURN_POINTER(result);
1355 POSTGIS_DEBUG(2,
"LWGEOM_line_from_mpoint called");
1358 ingeom = PG_GETARG_GSERIALIZED_P(0);
1362 elog(ERROR,
"makeline: input must be a multipoint");
1370 PG_FREE_IF_COPY(ingeom, 0);
1371 elog(ERROR,
"makeline: lwline_from_lwmpoint returned NULL");
1377 PG_FREE_IF_COPY(ingeom, 0);
1380 PG_RETURN_POINTER(result);
1399 ArrayIterator iterator;
1403 POSTGIS_DEBUGF(2,
"%s called", __func__);
1406 if ( PG_ARGISNULL(0) )
1410 array = PG_GETARG_ARRAYTYPE_P(0);
1413 nelems = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1415 POSTGIS_DEBUGF(3,
"%s: array has %d elements", __func__, nelems);
1429 geoms = palloc(
sizeof(
LWGEOM *) * nelems);
1432 #if POSTGIS_PGSQL_VERSION >= 95
1433 iterator = array_create_iterator(array, 0, NULL);
1435 iterator = array_create_iterator(array, 0);
1438 while( array_iterate(iterator, &
value, &isnull) )
1460 srid = geoms[ngeoms-1]->
srid;
1468 POSTGIS_DEBUGF(3,
"%s: element %d deserialized", __func__, ngeoms);
1470 array_free_iterator(iterator);
1476 elog(NOTICE,
"No points or linestrings in input array");
1480 POSTGIS_DEBUGF(3,
"LWGEOM_makeline_garray: elements: %d", ngeoms);
1486 PG_RETURN_POINTER(result);
1501 POSTGIS_DEBUG(2,
"LWGEOM_makeline called.");
1504 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
1505 pglwg2 = PG_GETARG_GSERIALIZED_P(1);
1510 elog(ERROR,
"Input geometries must be points or lines");
1523 PG_FREE_IF_COPY(pglwg1, 0);
1524 PG_FREE_IF_COPY(pglwg2, 1);
1528 PG_RETURN_POINTER(result);
1539 ArrayType *array=NULL;
1541 const LWLINE *shell=NULL;
1542 const LWLINE **holes=NULL;
1548 POSTGIS_DEBUG(2,
"LWGEOM_makepoly called.");
1551 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
1554 lwpgerror(
"Shell is not a line");
1559 if ( PG_NARGS() > 1 )
1561 array = PG_GETARG_ARRAYTYPE_P(1);
1562 nholes = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1564 for (i=0; i<nholes; i++)
1566 #pragma GCC diagnostic push
1567 #pragma GCC diagnostic ignored "-Wsign-compare"
1569 #pragma GCC diagnostic pop
1571 offset += INTALIGN(VARSIZE(g));
1574 lwpgerror(
"Hole %d is not a line", i);
1586 PG_FREE_IF_COPY(pglwg1, 0);
1588 for (i=0; i<nholes; i++)
1593 PG_RETURN_POINTER(result);
1611 POSTGIS_DEBUG(2,
"LWGEOM_expand called.");
1617 PG_RETURN_POINTER(geom);
1624 PG_RETURN_POINTER(geom);
1627 if (PG_NARGS() == 2)
1630 double d = PG_GETARG_FLOAT8(1);
1635 double dx = PG_GETARG_FLOAT8(1);
1636 double dy = PG_GETARG_FLOAT8(2);
1637 double dz = PG_GETARG_FLOAT8(3);
1638 double dm = PG_GETARG_FLOAT8(4);
1660 PG_FREE_IF_COPY(geom, 0);
1662 PG_RETURN_POINTER(result);
1669 GSERIALIZED *pg_lwgeom = PG_GETARG_GSERIALIZED_P(0);
1683 PG_FREE_IF_COPY(pg_lwgeom, 0);
1690 out->low.x = gbox.
xmin;
1691 out->low.y = gbox.
ymin;
1692 out->high.x = gbox.
xmax;
1693 out->high.y = gbox.
ymax;
1694 PG_RETURN_POINTER(out);
1707 int srid = lwgeom->
srid;
1717 PG_RETURN_POINTER(geom);
1723 PG_RETURN_POINTER(geom);
1793 PG_FREE_IF_COPY(geom, 0);
1795 PG_RETURN_POINTER(result);
1806 PG_FREE_IF_COPY(geom, 0);
1807 PG_RETURN_BOOL(empty);
1822 LWGEOM *inlwgeom, *outlwgeom;
1825 POSTGIS_DEBUG(2,
"LWGEOM_segmentize2d called");
1827 ingeom = PG_GETARG_GSERIALIZED_P(0);
1828 dist = PG_GETARG_FLOAT8(1);
1838 PG_RETURN_POINTER(ingeom);
1844 elog(ERROR,
"ST_Segmentize: invalid max_distance %g (must be >= 0)", dist);
1855 PG_RETURN_POINTER(ingeom);
1859 if ( ! outlwgeom ) {
1861 PG_FREE_IF_COPY(ingeom, 0);
1866 if ( inlwgeom->
bbox )
1874 PG_FREE_IF_COPY(ingeom, 0);
1876 PG_RETURN_POINTER(outgeom);
1886 POSTGIS_DEBUG(2,
"LWGEOM_reverse called");
1888 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
1895 PG_RETURN_POINTER(geom);
1905 POSTGIS_DEBUG(2,
"LWGEOM_force_clockwise_poly called");
1907 ingeom = PG_GETARG_GSERIALIZED_P_COPY(0);
1915 PG_FREE_IF_COPY(ingeom, 0);
1916 PG_RETURN_POINTER(outgeom);
1926 POSTGIS_DEBUG(2,
"LWGEOM_noop called");
1928 in = PG_GETARG_GSERIALIZED_P(0);
1932 POSTGIS_DEBUGF(3,
"Deserialized: %s",
lwgeom_summary(lwgeom, 0));
1937 PG_FREE_IF_COPY(in, 0);
1939 PG_RETURN_POINTER(out);
1947 LWGEOM *lwgeom_in, *lwgeom_out;
1949 POSTGIS_DEBUG(2,
"ST_Normalize called");
1951 in = PG_GETARG_GSERIALIZED_P_COPY(0);
1954 POSTGIS_DEBUGF(3,
"Deserialized: %s",
lwgeom_summary(lwgeom_in, 0));
1957 POSTGIS_DEBUGF(3,
"Normalized: %s",
lwgeom_summary(lwgeom_out, 0));
1963 PG_FREE_IF_COPY(in, 0);
1965 PG_RETURN_POINTER(out);
1982 in = PG_GETARG_GSERIALIZED_P(0);
1985 PG_FREE_IF_COPY(in, 0);
1986 PG_RETURN_INT16(ret);
2009 PG_FREE_IF_COPY(in, 0);
2010 PG_RETURN_BOOL(
res);
2020 in = PG_GETARG_GSERIALIZED_P(0);
2022 PG_FREE_IF_COPY(in, 0);
2023 PG_RETURN_INT16(ret);
2037 PG_FREE_IF_COPY(g1, 0);
2038 PG_FREE_IF_COPY(g2, 1);
2039 PG_RETURN_BOOL(
false);
2044 PG_FREE_IF_COPY(g1, 0);
2045 PG_FREE_IF_COPY(g2, 1);
2046 PG_RETURN_BOOL(
false);
2059 PG_FREE_IF_COPY(g1, 0);
2060 PG_FREE_IF_COPY(g2, 1);
2062 PG_RETURN_BOOL(result);
2070 double x1, y1, x2, y2;
2073 POSTGIS_DEBUG(2,
"ST_MakeEnvelope called");
2075 x1 = PG_GETARG_FLOAT8(0);
2076 y1 = PG_GETARG_FLOAT8(1);
2077 x2 = PG_GETARG_FLOAT8(2);
2078 y2 = PG_GETARG_FLOAT8(3);
2079 if ( PG_NARGS() > 4 ) {
2080 srid = PG_GETARG_INT32(4);
2088 PG_RETURN_POINTER(result);
2100 size = VARHDRSZ + 8 + 32 + 4;
2102 geom = PG_GETARG_GSERIALIZED_P_SLICE(0, 0, size);
2115 POSTGIS_DEBUG(2,
"LWGEOM_makepoint called");
2117 x = PG_GETARG_FLOAT8(0);
2118 y = PG_GETARG_FLOAT8(1);
2121 else if ( PG_NARGS() == 3 )
2123 z = PG_GETARG_FLOAT8(2);
2126 else if ( PG_NARGS() == 4 )
2128 z = PG_GETARG_FLOAT8(2);
2129 m = PG_GETARG_FLOAT8(3);
2134 elog(ERROR,
"LWGEOM_makepoint: unsupported number of args: %d",
2141 PG_RETURN_POINTER(result);
2151 POSTGIS_DEBUG(2,
"LWGEOM_makepoint3dm called.");
2153 x = PG_GETARG_FLOAT8(0);
2154 y = PG_GETARG_FLOAT8(1);
2155 m = PG_GETARG_FLOAT8(2);
2160 PG_RETURN_POINTER(result);
2171 POSTGIS_DEBUGF(2,
"%s called.", __func__);
2173 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
2174 pglwg2 = PG_GETARG_GSERIALIZED_P(1);
2178 elog(ERROR,
"First argument must be a LINESTRING");
2184 elog(ERROR,
"Second argument must be a POINT");
2190 if (PG_NARGS() <= 2)
2196 int32 where = PG_GETARG_INT32(2);
2203 elog(ERROR,
"%s: Invalid offset", __func__);
2218 elog(ERROR,
"Point insert failed");
2225 PG_FREE_IF_COPY(pglwg1, 0);
2226 PG_FREE_IF_COPY(pglwg2, 1);
2229 PG_RETURN_POINTER(result);
2239 POSTGIS_DEBUG(2,
"LWGEOM_removepoint called.");
2241 pglwg1 = PG_GETARG_GSERIALIZED_P(0);
2242 which = PG_GETARG_INT32(1);
2246 elog(ERROR,
"First argument must be a LINESTRING");
2254 elog(ERROR,
"Point index out of range (%d..%d)", 0, line->
points->
npoints-1);
2260 elog(ERROR,
"Can't remove points from a single segment line");
2271 PG_FREE_IF_COPY(pglwg1, 0);
2272 PG_RETURN_POINTER(result);
2285 POSTGIS_DEBUG(2,
"LWGEOM_setpoint_linestring called.");
2288 pglwg1 = PG_GETARG_GSERIALIZED_P_COPY(0);
2290 which = PG_GETARG_INT32(1);
2291 pglwg2 = PG_GETARG_GSERIALIZED_P(2);
2299 elog(ERROR,
"Third argument must be a POINT");
2304 PG_FREE_IF_COPY(pglwg2, 2);
2310 elog(ERROR,
"First argument must be a LINESTRING");
2315 elog(ERROR,
"Line has no points");
2325 elog(ERROR,
"abs(Point index) out of range (-)(%d..%d)", 0, line->
points->
npoints-1);
2339 PG_RETURN_POINTER(result);
2352 POSTGIS_DEBUG(2,
"LWGEOM_asEWKT called.");
2354 geom = PG_GETARG_GSERIALIZED_P(0);
2362 result = cstring_to_text(wkt);
2366 PG_FREE_IF_COPY(geom, 0);
2367 PG_RETURN_TEXT_P(result);
2386 geom = PG_GETARG_GSERIALIZED_P(0);
2390 PG_FREE_IF_COPY(geom, 0);
2391 lwpgerror(
"Argument must be POINT geometries");
2394 srid = lwpoint->
srid;
2397 PG_FREE_IF_COPY(geom, 0);
2398 lwpgerror(
"Error extracting point");
2402 PG_FREE_IF_COPY(geom, 0);
2405 geom = PG_GETARG_GSERIALIZED_P(1);
2409 PG_FREE_IF_COPY(geom, 1);
2410 lwpgerror(
"Argument must be POINT geometries");
2413 if ( lwpoint->
srid != srid )
2415 PG_FREE_IF_COPY(geom, 1);
2416 lwpgerror(
"Operation on mixed SRID geometries");
2421 PG_FREE_IF_COPY(geom, 1);
2422 lwpgerror(
"Error extracting point");
2426 PG_FREE_IF_COPY(geom, 1);
2429 if ( (p1.
x == p2.
x) && (p1.
y == p2.
y) )
2440 PG_RETURN_FLOAT8(result);
2463 int n_args = PG_NARGS();
2466 for(i=0; i<n_args; i++)
2468 seri_geoms[i] = PG_GETARG_GSERIALIZED_P(i);
2490 if(srids[0] != srids[i])
2502 PG_FREE_IF_COPY(seri_geoms[j], j);
2505 lwpgerror(
"Empty geometry");
2510 lwpgerror(
"Argument must be POINT geometries");
2515 lwpgerror(
"Operation on mixed SRID geometries");
2520 for(i=0; i<n_args; i++)
2526 for (j=0;j<n_args;j++)
2527 PG_FREE_IF_COPY(seri_geoms[j], j);
2528 lwpgerror(
"Error unserializing geometry");
2537 lwpgerror(
"Error extracting point");
2563 result += (result<0) * 2 * M_PI ;
2564 PG_RETURN_FLOAT8(result);
2578 GSERIALIZED *pg_geom1 = PG_GETARG_GSERIALIZED_P(0);
2579 GSERIALIZED *pg_geom2 = PG_GETARG_GSERIALIZED_P(1);
2580 double dist = PG_GETARG_FLOAT8(2);
2591 elog(ERROR,
"optimistic_overlap: first arg isn't a polygon\n");
2597 elog(ERROR,
"optimistic_overlap: 2nd arg isn't a [multi-]polygon\n");
2604 g1_bvol.
xmin = g1_bvol.
xmin - dist;
2605 g1_bvol.
ymin = g1_bvol.
ymin - dist;
2606 g1_bvol.
xmax = g1_bvol.
xmax + dist;
2607 g1_bvol.
ymax = g1_bvol.
ymax + dist;
2614 PG_RETURN_BOOL(
false);
2621 calc_dist = DatumGetFloat8 ( DirectFunctionCall2(
LWGEOM_mindistance2d, PointerGetDatum( pg_geom1 ), PointerGetDatum( pg_geom2 )));
2623 PG_RETURN_BOOL(calc_dist < dist);
2631 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P_COPY(0);
2636 affine.
afac = PG_GETARG_FLOAT8(1);
2637 affine.
bfac = PG_GETARG_FLOAT8(2);
2638 affine.
cfac = PG_GETARG_FLOAT8(3);
2639 affine.
dfac = PG_GETARG_FLOAT8(4);
2640 affine.
efac = PG_GETARG_FLOAT8(5);
2641 affine.
ffac = PG_GETARG_FLOAT8(6);
2642 affine.
gfac = PG_GETARG_FLOAT8(7);
2643 affine.
hfac = PG_GETARG_FLOAT8(8);
2644 affine.
ifac = PG_GETARG_FLOAT8(9);
2645 affine.
xoff = PG_GETARG_FLOAT8(10);
2646 affine.
yoff = PG_GETARG_FLOAT8(11);
2647 affine.
zoff = PG_GETARG_FLOAT8(12);
2649 POSTGIS_DEBUG(2,
"LWGEOM_affine called.");
2662 PG_FREE_IF_COPY(geom, 0);
2664 PG_RETURN_POINTER(ret);
2673 char *geohash = NULL;
2674 text *result = NULL;
2676 if ( PG_ARGISNULL(0) )
2681 geom = PG_GETARG_GSERIALIZED_P(0);
2683 if ( ! PG_ARGISNULL(1) )
2693 result = cstring_to_text(geohash);
2696 PG_RETURN_TEXT_P(result);
2706 int type = PG_GETARG_INT32(1);
2707 int lwgeom_type = lwgeom->
type;
2713 elog(ERROR,
"ST_CollectionExtract: only point, linestring and polygon may be extracted");
2721 if(lwgeom_type ==
type)
2724 PG_RETURN_POINTER(input);
2741 PG_RETURN_POINTER(output);
2757 PG_FREE_IF_COPY(input, 0);
2764 PG_FREE_IF_COPY(input, 0);
2765 PG_RETURN_POINTER(output);
2775 LWGEOM *lwgeom_in = NULL;
2776 LWGEOM *lwgeom_out = NULL;
2777 double tolerance = 0.0;
2781 PG_RETURN_POINTER(g_in);
2783 if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
2784 tolerance = PG_GETARG_FLOAT8(1);
2790 if (lwgeom_in->
bbox)
2795 if ( lwgeom_out != lwgeom_in )
2802 PG_FREE_IF_COPY(g_in, 0);
2803 PG_RETURN_POINTER(g_out);
2810 GSERIALIZED *in = PG_GETARG_GSERIALIZED_P_COPY(0);
2818 PG_FREE_IF_COPY(in, 0);
2820 PG_RETURN_POINTER(out);
2825 if ( n ==
'x' || n ==
'X' )
return LWORD_X;
2826 if ( n ==
'y' || n ==
'Y' )
return LWORD_Y;
2827 if ( n ==
'z' || n ==
'Z' )
return LWORD_Z;
2828 if ( n ==
'm' || n ==
'M' )
return LWORD_M;
2829 lwpgerror(
"Invalid ordinate name '%c'. Expected x,y,z or m", n);
2843 ospec = PG_GETARG_CSTRING(1);
2844 if ( strlen(ospec) != 2 )
2846 lwpgerror(
"Invalid ordinate specification. "
2847 "Need two letters from the set (x,y,z,m). "
2854 in = PG_GETARG_GSERIALIZED_P_COPY(0);
2859 lwpgerror(
"Geometry does not have an M ordinate");
2864 lwpgerror(
"Geometry does not have a Z ordinate");
2869 if ( o1 == o2 ) PG_RETURN_POINTER(in);
2875 PG_FREE_IF_COPY(in, 0);
2876 PG_RETURN_POINTER(out);
2886 GSERIALIZED *geom_in = PG_GETARG_GSERIALIZED_P(0);
2888 bool fits = PG_GETARG_BOOL(1);
2894 int srid = lwgeom_in->
srid;
2900 lwgeom_in->
bbox = NULL;
2926 PG_FREE_IF_COPY(geom_in, 0);
2931 PG_RETURN_POINTER(geom_out);
2939 GSERIALIZED *geom_scale = PG_GETARG_GSERIALIZED_P(1);
2941 LWGEOM *lwg, *lwg_scale, *lwg_origin;
2942 LWPOINT *lwpt_scale, *lwpt_origin;
2945 bool translate =
false;
2955 PG_FREE_IF_COPY(geom_scale, 1);
2956 lwpgerror(
"Scale factor geometry parameter must be a point");
2961 geom = PG_GETARG_GSERIALIZED_P_COPY(0);
2969 PG_FREE_IF_COPY(geom_scale, 1);
2970 PG_RETURN_POINTER(geom);
2981 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
2983 geom_origin = PG_GETARG_GSERIALIZED_P(2);
2993 PG_FREE_IF_COPY(geom_origin, 2);
3000 memset(&aff, 0,
sizeof(
AFFINE));
3004 aff.
xoff = -1 * origin.
x;
3005 aff.
yoff = -1 * origin.
y;
3006 aff.
zoff = -1 * origin.
z;
3024 PG_FREE_IF_COPY(geom, 0);
3025 PG_FREE_IF_COPY(geom_scale, 1);
3026 PG_RETURN_POINTER(ret);
3033 if (PG_ARGISNULL(0))
3048 PG_RETURN_POINTER(ret);
3063 if (PG_ARGISNULL(0))
3065 if (PG_ARGISNULL(1))
3067 lwpgerror(
"Must specify precision");
3072 prec_x = PG_GETARG_INT32(1);
3074 prec_y = PG_ARGISNULL(2) ? prec_x : PG_GETARG_INT32(2);
3075 prec_z = PG_ARGISNULL(3) ? prec_x : PG_GETARG_INT32(3);
3076 prec_m = PG_ARGISNULL(4) ? prec_x : PG_GETARG_INT32(4);
3078 input = PG_GETARG_GSERIALIZED_P_COPY(0);
3086 PG_FREE_IF_COPY(input, 0);
3087 PG_RETURN_POINTER(result);
3105 if ( PG_NARGS() > 0 && ! PG_ARGISNULL(0))
3107 geom_in = PG_GETARG_GSERIALIZED_P(0);
3114 if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1))
3115 min = PG_GETARG_FLOAT8(1);
3120 if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2))
3121 max = PG_GETARG_FLOAT8(2);
3126 if ( PG_NARGS() > 3 && ! PG_ARGISNULL(3) && PG_GETARG_BOOL(3))
3135 elog(ERROR,
"Min-value cannot be larger than Max value\n");
3145 elog(NOTICE,
"No M-value, No vertex removed\n");
3146 PG_RETURN_POINTER(geom_in);
3153 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.
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
int gserialized_has_z(const GSERIALIZED *gser)
Check if a GSERIALIZED has a Z ordinate.
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_get_zm(const GSERIALIZED *gser)
Return a number indicating presence of Z and M coordinates.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box)
Read the bounding box off a serialization and calculate one if it is not already there.
int gserialized_ndims(const GSERIALIZED *gser)
Return the number of dimensions (2, 3, 4) in a geometry.
int gserialized_has_m(const GSERIALIZED *gser)
Check if a GSERIALIZED has an M ordinate.
int gserialized_has_bbox(const GSERIALIZED *gser)
Check if a GSERIALIZED has a bounding box without deserializing first.
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
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)
LWPOINT * lwpoint_make2d(int srid, double x, double y)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
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.
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.
void lwmpoint_free(LWMPOINT *mpt)
LWGEOM * lwgeom_force_4d(const LWGEOM *geom)
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
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)
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 getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
double lwgeom_length(const LWGEOM *geom)
LWGEOM * lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
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)
Macros for manipulating the 'flags' byte.
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)
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
double lwgeom_area(const LWGEOM *geom)
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_make3dm(int srid, double x, double y, double m)
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)
LWLINE * lwline_from_lwmpoint(int srid, const LWMPOINT *mpoint)
void lwgeom_force_clockwise(LWGEOM *lwgeom)
Force Right-hand-rule on LWGEOM polygons.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
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)
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
#define FLAGS_GET_ZM(flags)
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
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)
LWPOINT * lwpoint_make3dz(int srid, double x, double y, double z)
double lwgeom_maxdistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling max distance calculations and dfullywithin calculations.
void error_if_srid_mismatch(int srid1, int srid2)
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.
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
void lwgeom_set_srid(LWGEOM *geom, int srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
LWGEOM * lwgeom_force_3dz(const LWGEOM *geom)
LWLINE * lwline_removepoint(LWLINE *line, uint32_t which)
LWGEOM * lwgeom_construct_empty(uint8_t type, int srid, char hasz, char hasm)
LWPOINT * lwpoint_make4d(int srid, double x, double y, double z, double m)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
void lwline_free(LWLINE *line)
LWPOLY * lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2)
LWLINE * lwline_from_lwgeom_array(int 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 area(PG_FUNCTION_ARGS)
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 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_CollectionHomogenize(PG_FUNCTION_ARGS)
Datum LWGEOM_shortestline3d(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 postgis_autocache_bbox(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 postgis_uses_stats(PG_FUNCTION_ARGS)
Datum LWGEOM_zmflag(PG_FUNCTION_ARGS)
Datum ST_GeoHash(PG_FUNCTION_ARGS)
Datum ST_IsCollection(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 LWGEOM_mindistance2d(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 LWGEOM_area_polygon(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)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
#define POSTGIS_LIB_VERSION
#define POSTGIS_LIBXML2_VERSION