[postgis-tickets] r14946 - style only change: remove trailing spaces
Sandro Santilli
strk at kbt.io
Wed Jun 15 02:14:27 PDT 2016
Author: strk
Date: 2016-06-15 02:14:27 -0700 (Wed, 15 Jun 2016)
New Revision: 14946
Modified:
trunk/postgis/lwgeom_functions_basic.c
trunk/postgis/postgis.sql.in
Log:
style only change: remove trailing spaces
Modified: trunk/postgis/lwgeom_functions_basic.c
===================================================================
--- trunk/postgis/lwgeom_functions_basic.c 2016-06-14 10:29:08 UTC (rev 14945)
+++ trunk/postgis/lwgeom_functions_basic.c 2016-06-15 09:14:27 UTC (rev 14946)
@@ -140,7 +140,7 @@
/* create a text obj to return */
mytext = cstring2text(result);
pfree(result);
-
+
PG_FREE_IF_COPY(geom,0);
PG_RETURN_TEXT_P(mytext);
}
@@ -176,7 +176,7 @@
char ver[32];
if ( rev > 0 )
{
- snprintf(ver, 32, "%d", rev);
+ snprintf(ver, 32, "%d", rev);
PG_RETURN_TEXT_P(cstring2text(ver));
}
else
@@ -276,9 +276,9 @@
area = lwgeom_area(lwgeom);
- lwgeom_free(lwgeom);
+ lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 0);
-
+
PG_RETURN_FLOAT8(area);
}
@@ -331,7 +331,7 @@
GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
double perimeter = 0.0;
-
+
perimeter = lwgeom_perimeter(lwgeom);
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_FLOAT8(perimeter);
@@ -350,7 +350,7 @@
GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
double perimeter = 0.0;
-
+
perimeter = lwgeom_perimeter_2d(lwgeom);
PG_FREE_IF_COPY(geom, 0);
PG_RETURN_FLOAT8(perimeter);
@@ -619,7 +619,7 @@
if (lwgeom_is_empty(point))
PG_RETURN_NULL();
-
+
result = geometry_serialize(point);
lwgeom_free(point);
lwgeom_free(lwgeom1);
@@ -646,9 +646,9 @@
error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
theline = lwgeom_closest_line(lwgeom1, lwgeom2);
-
+
if (lwgeom_is_empty(theline))
- PG_RETURN_NULL();
+ PG_RETURN_NULL();
result = geometry_serialize(theline);
lwgeom_free(theline);
@@ -676,7 +676,7 @@
error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
theline = lwgeom_furthest_line(lwgeom1, lwgeom2);
-
+
if (lwgeom_is_empty(theline))
PG_RETURN_NULL();
@@ -710,11 +710,11 @@
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
-
+
/*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
if (mindist<FLT_MAX)
PG_RETURN_FLOAT8(mindist);
-
+
PG_RETURN_NULL();
}
@@ -729,7 +729,7 @@
double mindist;
GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
- double tolerance = PG_GETARG_FLOAT8(2);
+ double tolerance = PG_GETARG_FLOAT8(2);
LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
@@ -761,7 +761,7 @@
double maxdist;
GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
- double tolerance = PG_GETARG_FLOAT8(2);
+ double tolerance = PG_GETARG_FLOAT8(2);
LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
@@ -772,16 +772,16 @@
}
error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
-
+
maxdist = lwgeom_maxdistance2d_tolerance(lwgeom1, lwgeom2, tolerance);
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
-
+
/*If function is feed with empty geometries we should return false*/
if (maxdist>-1)
PG_RETURN_BOOL(tolerance >= maxdist);
-
+
PG_RETURN_BOOL(LW_FALSE);
}
@@ -803,11 +803,11 @@
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
-
+
/*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
if (maxdist>-1)
PG_RETURN_FLOAT8(maxdist);
-
+
PG_RETURN_NULL();
}
@@ -831,10 +831,10 @@
// point = lw_dist3d_distancepoint(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
if (lwgeom_is_empty(point))
- PG_RETURN_NULL();
+ PG_RETURN_NULL();
result = geometry_serialize(point);
-
+
lwgeom_free(point);
lwgeom_free(lwgeom1);
lwgeom_free(lwgeom2);
@@ -861,12 +861,12 @@
theline = lwgeom_closest_line_3d(lwgeom1, lwgeom2);
// theline = lw_dist3d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MIN);
-
+
if (lwgeom_is_empty(theline))
PG_RETURN_NULL();
result = geometry_serialize(theline);
-
+
lwgeom_free(theline);
lwgeom_free(lwgeom1);
lwgeom_free(lwgeom2);
@@ -893,12 +893,12 @@
theline = lwgeom_furthest_line_3d(lwgeom1, lwgeom2);
// theline = lw_dist3d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MAX);
-
+
if (lwgeom_is_empty(theline))
PG_RETURN_NULL();
-
+
result = geometry_serialize(theline);
-
+
lwgeom_free(theline);
lwgeom_free(lwgeom1);
lwgeom_free(lwgeom2);
@@ -925,7 +925,7 @@
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
-
+
/*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
if (mindist<FLT_MAX)
PG_RETURN_FLOAT8(mindist);
@@ -944,7 +944,7 @@
double mindist;
GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
- double tolerance = PG_GETARG_FLOAT8(2);
+ double tolerance = PG_GETARG_FLOAT8(2);
LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
@@ -960,7 +960,7 @@
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
-
+
/*empty geometries cases should be right handled since return from underlying
functions should be FLT_MAX which causes false as answer*/
PG_RETURN_BOOL(tolerance >= mindist);
@@ -977,7 +977,7 @@
double maxdist;
GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
- double tolerance = PG_GETARG_FLOAT8(2);
+ double tolerance = PG_GETARG_FLOAT8(2);
LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
@@ -992,7 +992,7 @@
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
-
+
/*If function is feed with empty geometries we should return false*/
if (maxdist>-1)
PG_RETURN_BOOL(tolerance >= maxdist);
@@ -1018,7 +1018,7 @@
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
-
+
/*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
if (maxdist>-1)
PG_RETURN_FLOAT8(maxdist);
@@ -1133,7 +1133,7 @@
type1 = lwgeoms[0]->type;
type2 = lwgeoms[1]->type;
-
+
if ( (type1 == type2) && (!lwgeom_is_collection(lwgeoms[0])) )
outtype = lwtype_get_collectiontype(type1);
else
@@ -1212,12 +1212,12 @@
count = 0;
outtype = 0;
-#if POSTGIS_PGSQL_VERSION >= 95
+#if POSTGIS_PGSQL_VERSION >= 95
iterator = array_create_iterator(array, 0, NULL);
#else
iterator = array_create_iterator(array, 0);
#endif
-
+
while( array_iterate(iterator, &value, &isnull) )
{
GSERIALIZED *geom;
@@ -1226,7 +1226,7 @@
/* Don't do anything for NULL values */
if ( isnull )
continue;
-
+
geom = (GSERIALIZED *)DatumGetPointer(value);
intype = gserialized_get_type(geom);
@@ -1284,8 +1284,8 @@
}
array_free_iterator(iterator);
-
+
POSTGIS_DEBUGF(3, "LWGEOM_collect_garray: outtype = %d", outtype);
/* If we have been passed a complete set of NULLs then return NULL */
@@ -1359,7 +1359,7 @@
LWGEOM *outlwg;
uint32 ngeoms;
int srid = SRID_UNKNOWN;
-
+
ArrayIterator iterator;
Datum value;
bool isnull;
@@ -1393,7 +1393,7 @@
geoms = palloc(sizeof(LWGEOM *) * nelems);
ngeoms = 0;
-#if POSTGIS_PGSQL_VERSION >= 95
+#if POSTGIS_PGSQL_VERSION >= 95
iterator = array_create_iterator(array, 0, NULL);
#else
iterator = array_create_iterator(array, 0);
@@ -1405,7 +1405,7 @@
if ( isnull )
continue;
-
+
geom = (GSERIALIZED *)DatumGetPointer(value);
if ( gserialized_get_type(geom) != POINTTYPE &&
@@ -1632,7 +1632,7 @@
GBOX gbox;
int result;
BOX *out = NULL;
-
+
/* Zero out flags */
gbox_init(&gbox);
@@ -1642,11 +1642,11 @@
/* Clean up memory */
lwfree(lwgeom);
PG_FREE_IF_COPY(pg_lwgeom, 0);
-
+
/* Null on failure */
if ( ! result )
PG_RETURN_NULL();
-
+
out = lwalloc(sizeof(BOX));
out->low.x = gbox.xmin;
out->low.y = gbox.ymin;
@@ -1677,13 +1677,13 @@
/* must be the EMPTY geometry */
PG_RETURN_POINTER(geom);
}
-
+
if ( lwgeom_calculate_gbox(lwgeom, &box) == LW_FAILURE )
{
/* must be the EMPTY geometry */
PG_RETURN_POINTER(geom);
}
-
+
/*
* Alter envelope type so that a valid geometry is always
* returned depending upon the size of the geometry. The
@@ -1815,7 +1815,7 @@
lwgeom_free(inlwgeom);
PG_RETURN_POINTER(ingeom);
}
-
+
outlwgeom = lwgeom_segmentize2d(inlwgeom, dist);
if ( ! outlwgeom ) {
/* Should only happen on interruption */
@@ -1831,7 +1831,7 @@
//lwgeom_free(outlwgeom); /* TODO fix lwgeom_clone / ptarray_clone_deep for consistent semantics */
lwgeom_free(inlwgeom);
-
+
PG_FREE_IF_COPY(ingeom, 0);
PG_RETURN_POINTER(outgeom);
@@ -2167,7 +2167,7 @@
point = lwgeom_as_lwpoint(lwgeom_from_gserialized(pglwg2));
linecopy = lwgeom_as_lwline(lwgeom_clone_deep(lwline_as_lwgeom(line)));
lwline_free(line);
-
+
if ( lwline_add_lwpoint(linecopy, point, where) == LW_FAILURE )
{
elog(ERROR, "Point insert failed");
@@ -2518,7 +2518,7 @@
result = cstring2text(geohash);
pfree(geohash);
-
+
PG_RETURN_TEXT_P(result);
}
Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in 2016-06-14 10:29:08 UTC (rev 14945)
+++ trunk/postgis/postgis.sql.in 2016-06-15 09:14:27 UTC (rev 14946)
@@ -63,7 +63,7 @@
RAISE DEBUG '% signature was deprecated in %. Please use %', oldname, version, newname;
END IF;
END;
-$$ LANGUAGE 'plpgsql' IMMUTABLE STRICT
+$$ LANGUAGE 'plpgsql' IMMUTABLE STRICT
COST 100;
-------------------------------------------------------------------
@@ -272,7 +272,7 @@
-- BOX2DF TYPE (INTERNAL ONLY)
-------------------------------------------------------------------
--
--- Box2Df type is used by the GiST index bindings.
+-- Box2Df type is used by the GiST index bindings.
-- In/out functions are stubs, as all access should be internal.
---
-- Availability: 2.0.0
@@ -301,7 +301,7 @@
-- GIDX TYPE (INTERNAL ONLY)
-------------------------------------------------------------------
--
--- GIDX type is used by the N-D and GEOGRAPHY GiST index bindings.
+-- GIDX type is used by the N-D and GEOGRAPHY GiST index bindings.
-- In/out functions are stubs, as all access should be internal.
---
@@ -418,50 +418,50 @@
-- ---------- ---------- ---------- ---------- ---------- ---------- ----------
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_distance_2d(internal,geometry,int4)
- RETURNS float8
+CREATE OR REPLACE FUNCTION geometry_gist_distance_2d(internal,geometry,int4)
+ RETURNS float8
AS 'MODULE_PATHNAME' ,'gserialized_gist_distance_2d'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_consistent_2d(internal,geometry,int4)
- RETURNS bool
+CREATE OR REPLACE FUNCTION geometry_gist_consistent_2d(internal,geometry,int4)
+ RETURNS bool
AS 'MODULE_PATHNAME' ,'gserialized_gist_consistent_2d'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_compress_2d(internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_compress_2d(internal)
+ RETURNS internal
AS 'MODULE_PATHNAME','gserialized_gist_compress_2d'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_penalty_2d(internal,internal,internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_penalty_2d(internal,internal,internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_penalty_2d'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_picksplit_2d(internal, internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_picksplit_2d(internal, internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_picksplit_2d'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_union_2d(bytea, internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_union_2d(bytea, internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_union_2d'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_same_2d(geom1 geometry, geom2 geometry, internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_same_2d(geom1 geometry, geom2 geometry, internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_same_2d'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_decompress_2d(internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_decompress_2d(internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_decompress_2d'
LANGUAGE 'c';
@@ -488,7 +488,7 @@
LANGUAGE 'c' STRICT _PARALLEL;
-- Availability: 2.1.0
--- Given a table and a column, returns the statistics information stored by
+-- Given a table and a column, returns the statistics information stored by
-- PostgreSQL, in a JSON text form. Mode determines whether the 2D statistics
-- or the ND statistics are returned.
CREATE OR REPLACE FUNCTION _postgis_stats(tbl regclass, att_name text, text default '2')
@@ -530,8 +530,8 @@
-- ---------- ---------- ---------- ---------- ---------- ---------- ----------
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_overlaps(geom1 geometry, geom2 geometry)
- RETURNS boolean
+CREATE OR REPLACE FUNCTION geometry_overlaps(geom1 geometry, geom2 geometry)
+ RETURNS boolean
AS 'MODULE_PATHNAME' ,'gserialized_overlaps_2d'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
@@ -540,13 +540,13 @@
CREATE OPERATOR && (
LEFTARG = geometry, RIGHTARG = geometry, PROCEDURE = geometry_overlaps,
COMMUTATOR = '&&',
- RESTRICT = gserialized_gist_sel_2d,
- JOIN = gserialized_gist_joinsel_2d
+ RESTRICT = gserialized_gist_sel_2d,
+ JOIN = gserialized_gist_joinsel_2d
);
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_same(geom1 geometry, geom2 geometry)
- RETURNS boolean
+CREATE OR REPLACE FUNCTION geometry_same(geom1 geometry, geom2 geometry)
+ RETURNS boolean
AS 'MODULE_PATHNAME' ,'gserialized_same_2d'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
@@ -556,12 +556,12 @@
RESTRICT = contsel, JOIN = contjoinsel
);
--- As of 2.2.0 this no longer returns the centroid/centroid distance, it
+-- As of 2.2.0 this no longer returns the centroid/centroid distance, it
-- returns the actual distance, to support the 'recheck' functionality
-- enabled in the KNN operator
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_distance_centroid(geom1 geometry, geom2 geometry)
- RETURNS float8
+CREATE OR REPLACE FUNCTION geometry_distance_centroid(geom1 geometry, geom2 geometry)
+ RETURNS float8
#if POSTGIS_PGSQL_VERSION >= 95
AS 'MODULE_PATHNAME' ,'distance'
#else
@@ -570,8 +570,8 @@
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_distance_box(geom1 geometry, geom2 geometry)
- RETURNS float8
+CREATE OR REPLACE FUNCTION geometry_distance_box(geom1 geometry, geom2 geometry)
+ RETURNS float8
AS 'MODULE_PATHNAME' ,'gserialized_distance_box_2d'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
@@ -756,44 +756,44 @@
-- ---------- ---------- ---------- ---------- ---------- ---------- ----------
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_consistent_nd(internal,geometry,int4)
- RETURNS bool
+CREATE OR REPLACE FUNCTION geometry_gist_consistent_nd(internal,geometry,int4)
+ RETURNS bool
AS 'MODULE_PATHNAME' ,'gserialized_gist_consistent'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_compress_nd(internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_compress_nd(internal)
+ RETURNS internal
AS 'MODULE_PATHNAME','gserialized_gist_compress'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_penalty_nd(internal,internal,internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_penalty_nd(internal,internal,internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_penalty'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_picksplit_nd(internal, internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_picksplit_nd(internal, internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_picksplit'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_union_nd(bytea, internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_union_nd(bytea, internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_union'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_same_nd(geometry, geometry, internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_same_nd(geometry, geometry, internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_same'
LANGUAGE 'c';
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_gist_decompress_nd(internal)
- RETURNS internal
+CREATE OR REPLACE FUNCTION geometry_gist_decompress_nd(internal)
+ RETURNS internal
AS 'MODULE_PATHNAME' ,'gserialized_gist_decompress'
LANGUAGE 'c';
@@ -803,8 +803,8 @@
-- ---------- ---------- ---------- ---------- ---------- ---------- ----------
-- Availability: 2.0.0
-CREATE OR REPLACE FUNCTION geometry_overlaps_nd(geometry, geometry)
- RETURNS boolean
+CREATE OR REPLACE FUNCTION geometry_overlaps_nd(geometry, geometry)
+ RETURNS boolean
AS 'MODULE_PATHNAME' ,'gserialized_overlaps'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
@@ -813,7 +813,7 @@
LEFTARG = geometry, RIGHTARG = geometry, PROCEDURE = geometry_overlaps_nd,
COMMUTATOR = '&&&',
RESTRICT = gserialized_gist_sel_nd,
- JOIN = gserialized_gist_joinsel_nd
+ JOIN = gserialized_gist_joinsel_nd
);
-- Availability: 2.2.0
@@ -979,10 +979,10 @@
LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER;
-- Availability: 1.2.2
--- Deprecation in 2.1.0
+-- Deprecation in 2.1.0
CREATE OR REPLACE FUNCTION ST_estimated_extent(text,text,text) RETURNS box2d AS
$$ SELECT _postgis_deprecate('ST_Estimated_Extent', 'ST_EstimatedExtent', '2.1.0');
- -- We use security invoker instead of security definer
+ -- We use security invoker instead of security definer
-- to prevent malicious injection of a different same named function
SELECT ST_EstimatedExtent($1, $2, $3);
$$
@@ -998,10 +998,10 @@
LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER;
-- Availability: 1.2.2
--- Deprecation in 2.1.0
+-- Deprecation in 2.1.0
CREATE OR REPLACE FUNCTION ST_estimated_extent(text,text) RETURNS box2d AS
$$ SELECT _postgis_deprecate('ST_Estimated_Extent', 'ST_EstimatedExtent', '2.1.0');
- -- We use security invoker instead of security definer
+ -- We use security invoker instead of security definer
-- to prevent malicious injection of a same named different function
-- that would be run under elevated permissions
SELECT ST_EstimatedExtent($1, $2);
@@ -1476,7 +1476,7 @@
AS 'MODULE_PATHNAME', 'LWGEOM_noop'
LANGUAGE 'c' VOLATILE STRICT
COST 10;
-
+
-- Deprecation in 1.5.0
CREATE OR REPLACE FUNCTION ST_zmflag(geometry)
RETURNS smallint
@@ -1497,7 +1497,7 @@
AS 'MODULE_PATHNAME','LWGEOM_asEWKT'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
COST 750; --this looks suspicious, requires recheck
-
+
-- Availability: 2.2.0
CREATE OR REPLACE FUNCTION ST_AsTWKB(geom geometry, prec int4 default NULL, prec_z int4 default NULL, prec_m int4 default NULL, with_sizes boolean default NULL, with_boxes boolean default NULL)
RETURNS bytea
@@ -1625,7 +1625,7 @@
RETURNS geometry
AS 'MODULE_PATHNAME', 'LWGEOM_line_from_mpoint'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+
-- Availability: 1.2.2
CREATE OR REPLACE FUNCTION ST_MakeLine(geom1 geometry, geom2 geometry)
RETURNS geometry
@@ -1841,15 +1841,15 @@
i integer;
j integer;
g geometry;
-
+
BEGIN
-
+
-- RAISE DEBUG '%,%', cur_path, ST_GeometryType(the_geom);
-- Special case collections : iterate and return the DumpPoints of the geometries
IF (ST_IsCollection(the_geom)) THEN
-
+
i = 1;
FOR tmp2 IN SELECT (ST_Dump(the_geom)).* LOOP
@@ -1857,27 +1857,27 @@
RETURN NEXT tmp;
END LOOP;
i = i + 1;
-
+
END LOOP;
RETURN;
END IF;
-
+
-- Special case (POLYGON) : return the points of the rings of a polygon
IF (ST_GeometryType(the_geom) = 'ST_Polygon') THEN
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_ExteriorRing(the_geom), cur_path || ARRAY[1]) LOOP
RETURN NEXT tmp;
END LOOP;
-
+
j := ST_NumInteriorRings(the_geom);
FOR i IN 1..j LOOP
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_InteriorRingN(the_geom, i), cur_path || ARRAY[i+1]) LOOP
RETURN NEXT tmp;
END LOOP;
END LOOP;
-
+
RETURN;
END IF;
@@ -1887,11 +1887,11 @@
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_ExteriorRing(the_geom), cur_path || ARRAY[1]) LOOP
RETURN NEXT tmp;
END LOOP;
-
+
RETURN;
END IF;
-
+
-- Special case (POINT) : return the point
IF (ST_GeometryType(the_geom) = 'ST_Point') THEN
@@ -1918,14 +1918,14 @@
tmp.geom := ST_PointN(the_geom, i);
RETURN NEXT tmp;
END LOOP;
-
+
END
$$ LANGUAGE plpgsql;
-----------------------------------------------------------------------
-- ST_DumpPoints()
-----------------------------------------------------------------------
--- This function mimicks that of ST_Dump for collections, but this function
+-- This function mimicks that of ST_Dump for collections, but this function
-- that returns a path and all the points that make up a particular geometry.
-- Availability: 1.5.0
CREATE OR REPLACE FUNCTION ST_DumpPoints(geometry)
@@ -1959,7 +1959,7 @@
-- geometry_columns table.
-- Availability: 1.4.0
-- Revised: 2.0.0 -- no longer deletes from geometry_columns
--- Has new use_typmod option that defaults to true.
+-- Has new use_typmod option that defaults to true.
-- If use typmod is set to false will use old constraint behavior.
-- Will only touch table missing typmod or geometry constraints
-----------------------------------------------------------------------
@@ -2012,7 +2012,7 @@
AND a.atttypid = t.oid
AND a.attrelid = c.oid
AND c.relnamespace = n.oid
- AND n.nspname NOT ILIKE 'pg_temp%' AND c.relname != 'raster_columns'
+ AND n.nspname NOT ILIKE 'pg_temp%' AND c.relname != 'raster_columns'
LOOP
inserted := inserted + populate_geometry_columns(gcs.oid, use_typmod);
@@ -2088,20 +2088,20 @@
LOOP
RAISE DEBUG 'Processing column %.%.%', gcs.nspname, gcs.relname, gcs.attname;
-
+
gc_is_valid := true;
-- Find the srid, coord_dimension, and type of current geometry
-- in geometry_columns -- which is now a view
-
- SELECT type, srid, coord_dimension INTO gc_old
- FROM geometry_columns
- WHERE f_table_schema = gcs.nspname AND f_table_name = gcs.relname AND f_geometry_column = gcs.attname;
-
+
+ SELECT type, srid, coord_dimension INTO gc_old
+ FROM geometry_columns
+ WHERE f_table_schema = gcs.nspname AND f_table_name = gcs.relname AND f_geometry_column = gcs.attname;
+
IF upper(gc_old.type) = 'GEOMETRY' THEN
-- This is an unconstrained geometry we need to do something
-- We need to figure out what to set the type by inspecting the data
EXECUTE 'SELECT st_srid(' || quote_ident(gcs.attname) || ') As srid, GeometryType(' || quote_ident(gcs.attname) || ') As type, ST_NDims(' || quote_ident(gcs.attname) || ') As dims ' ||
- ' FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
+ ' FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
' WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1;'
INTO gc;
IF gc IS NULL THEN -- there is no data so we can not determine geometry type
@@ -2109,10 +2109,10 @@
RETURN 0;
END IF;
gsrid := gc.srid; gtype := gc.type; gndims := gc.dims;
-
+
IF use_typmod THEN
BEGIN
- EXECUTE 'ALTER TABLE ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || ' ALTER COLUMN ' || quote_ident(gcs.attname) ||
+ EXECUTE 'ALTER TABLE ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || ' ALTER COLUMN ' || quote_ident(gcs.attname) ||
' TYPE geometry(' || postgis_type_name(gtype, gndims, true) || ', ' || gsrid::text || ') ';
inserted := inserted + 1;
EXCEPTION
@@ -2120,14 +2120,14 @@
RAISE WARNING 'Could not convert ''%'' in ''%.%'' to use typmod with srid %, type %: %', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname), gsrid, postgis_type_name(gtype, gndims, true), SQLERRM;
gc_is_valid := false;
END;
-
+
ELSE
-- Try to apply srid check to column
constraint_successful = false;
IF (gsrid > 0 AND postgis_constraint_srid(gcs.nspname, gcs.relname,gcs.attname) IS NULL ) THEN
BEGIN
- EXECUTE 'ALTER TABLE ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
- ' ADD CONSTRAINT ' || quote_ident('enforce_srid_' || gcs.attname) ||
+ EXECUTE 'ALTER TABLE ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
+ ' ADD CONSTRAINT ' || quote_ident('enforce_srid_' || gcs.attname) ||
' CHECK (st_srid(' || quote_ident(gcs.attname) || ') = ' || gsrid || ')';
constraint_successful := true;
EXCEPTION
@@ -2136,7 +2136,7 @@
gc_is_valid := false;
END;
END IF;
-
+
-- Try to apply ndims check to column
IF (gndims IS NOT NULL AND postgis_constraint_dims(gcs.nspname, gcs.relname,gcs.attname) IS NULL ) THEN
BEGIN
@@ -2150,7 +2150,7 @@
gc_is_valid := false;
END;
END IF;
-
+
-- Try to apply geometrytype check to column
IF (gtype IS NOT NULL AND postgis_constraint_type(gcs.nspname, gcs.relname,gcs.attname) IS NULL ) THEN
BEGIN
@@ -2168,7 +2168,7 @@
IF constraint_successful THEN
inserted := inserted + 1;
END IF;
- END IF;
+ END IF;
END IF;
END LOOP;
@@ -2319,7 +2319,7 @@
') = ' || new_srid::text || ')' ;
RAISE DEBUG '%', sql;
EXECUTE sql;
-
+
sql := 'ALTER TABLE ' ||
quote_ident(real_schema) || '.' || quote_ident(table_name)
|| ' ADD CONSTRAINT '
@@ -2328,7 +2328,7 @@
') = ' || new_dim::text || ')' ;
RAISE DEBUG '%', sql;
EXECUTE sql;
-
+
IF ( NOT (new_type = 'GEOMETRY')) THEN
sql := 'ALTER TABLE ' ||
quote_ident(real_schema) || '.' || quote_ident(table_name) || ' ADD CONSTRAINT ' ||
@@ -2620,34 +2620,34 @@
END IF;
END IF;
- IF postgis_constraint_srid(real_schema, table_name, column_name) IS NOT NULL THEN
+ IF postgis_constraint_srid(real_schema, table_name, column_name) IS NOT NULL THEN
-- srid was enforced with constraints before, keep it that way.
-- Make up constraint name
cname = 'enforce_srid_' || column_name;
-
+
-- Drop enforce_srid constraint
EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||
'.' || quote_ident(table_name) ||
' DROP constraint ' || quote_ident(cname);
-
+
-- Update geometries SRID
EXECUTE 'UPDATE ' || quote_ident(real_schema) ||
'.' || quote_ident(table_name) ||
' SET ' || quote_ident(column_name) ||
' = ST_SetSRID(' || quote_ident(column_name) ||
', ' || new_srid::text || ')';
-
+
-- Reset enforce_srid constraint
EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||
'.' || quote_ident(table_name) ||
' ADD constraint ' || quote_ident(cname) ||
' CHECK (st_srid(' || quote_ident(column_name) ||
') = ' || new_srid::text || ')';
- ELSE
+ ELSE
-- We will use typmod to enforce if no srid constraints
- -- We are using postgis_type_name to lookup the new name
- -- (in case Paul changes his mind and flips geometry_columns to return old upper case name)
- EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' || quote_ident(table_name) ||
+ -- We are using postgis_type_name to lookup the new name
+ -- (in case Paul changes his mind and flips geometry_columns to return old upper case name)
+ EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' || quote_ident(table_name) ||
' ALTER COLUMN ' || quote_ident(column_name) || ' TYPE geometry(' || postgis_type_name(myrec.type, myrec.coord_dimension, true) || ', ' || new_srid::text || ') USING ST_SetSRID(' || quote_ident(column_name) || ',' || new_srid::text || ');' ;
END IF;
@@ -2982,7 +2982,7 @@
---------------------------------------------------------------
-- CASTS
---------------------------------------------------------------
-
+
CREATE OR REPLACE FUNCTION box2d(geometry)
RETURNS box2d
AS 'MODULE_PATHNAME','LWGEOM_to_BOX2D'
@@ -3059,7 +3059,7 @@
CREATE CAST (geometry AS box2d) WITH FUNCTION box2d(geometry) AS IMPLICIT;
CREATE CAST (geometry AS box3d) WITH FUNCTION box3d(geometry) AS IMPLICIT;
--- ticket: 2262 changed 2.1.0 to assignment to prevent PostGIS
+-- ticket: 2262 changed 2.1.0 to assignment to prevent PostGIS
-- from misusing PostgreSQL geometric functions
CREATE CAST (geometry AS box) WITH FUNCTION box(geometry) AS ASSIGNMENT;
@@ -3091,14 +3091,14 @@
AS 'MODULE_PATHNAME', 'LWGEOM_simplify2d'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
COST 50; -- COST guessed from ST_Simplify(geometry, float8)
-
+
-- Availability: 2.2.0
CREATE OR REPLACE FUNCTION ST_SimplifyVW(geometry, float8)
RETURNS geometry
AS 'MODULE_PATHNAME', 'LWGEOM_SetEffectiveArea'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
COST 50; -- COST guessed from ST_Simplify(geometry, float8)
-
+
-- Availability: 2.2.0
CREATE OR REPLACE FUNCTION ST_SetEffectiveArea(geometry, float8 default -1, integer default 1)
RETURNS geometry
@@ -3155,7 +3155,7 @@
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 1.2.2
--- Deprecation in 2.1.0
+-- Deprecation in 2.1.0
CREATE OR REPLACE FUNCTION ST_line_interpolate_point(geometry, float8)
RETURNS geometry AS
$$ SELECT _postgis_deprecate('ST_Line_Interpolate_Point', 'ST_LineInterpolatePoint', '2.1.0');
@@ -3170,7 +3170,7 @@
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 1.2.2
--- Deprecation in 2.1.0
+-- Deprecation in 2.1.0
CREATE OR REPLACE FUNCTION ST_line_substring(geometry, float8, float8)
RETURNS geometry AS
$$ SELECT _postgis_deprecate('ST_Line_Substring', 'ST_LineSubstring', '2.1.0');
@@ -3185,7 +3185,7 @@
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 1.2.2
--- Deprecation in 2.1.0
+-- Deprecation in 2.1.0
CREATE OR REPLACE FUNCTION ST_line_locate_point(geom1 geometry, geom2 geometry)
RETURNS float8 AS
$$ SELECT _postgis_deprecate('ST_Line_Locate_Point', 'ST_LineLocatePoint', '2.1.0');
@@ -3210,9 +3210,9 @@
LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
-- Availability: 1.5.0
-CREATE OR REPLACE FUNCTION ST_AddMeasure(geometry, float8, float8)
- RETURNS geometry
- AS 'MODULE_PATHNAME', 'ST_AddMeasure'
+CREATE OR REPLACE FUNCTION ST_AddMeasure(geometry, float8, float8)
+ RETURNS geometry
+ AS 'MODULE_PATHNAME', 'ST_AddMeasure'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
---------------------------------------------------------------
@@ -3221,13 +3221,13 @@
-- Availability: 2.2.0
CREATE OR REPLACE FUNCTION ST_ClosestPointOfApproach(geometry, geometry)
- RETURNS float8
- AS 'MODULE_PATHNAME', 'ST_ClosestPointOfApproach'
+ RETURNS float8
+ AS 'MODULE_PATHNAME', 'ST_ClosestPointOfApproach'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 2.2.0
CREATE OR REPLACE FUNCTION ST_DistanceCPA(geometry, geometry)
- RETURNS float8
+ RETURNS float8
AS 'MODULE_PATHNAME', 'ST_DistanceCPA'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
@@ -3239,10 +3239,10 @@
-- Availability: 2.2.0
CREATE OR REPLACE FUNCTION ST_IsValidTrajectory(geometry)
- RETURNS bool
- AS 'MODULE_PATHNAME', 'ST_IsValidTrajectory'
+ RETURNS bool
+ AS 'MODULE_PATHNAME', 'ST_IsValidTrajectory'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+
---------------------------------------------------------------
-- GEOS
---------------------------------------------------------------
@@ -3506,13 +3506,13 @@
-- - Simple (lineal components)
-- - Valid (polygonal components)
-- - Obeying the RHR (if polygonal)
--- - Simplified of consecutive duplicated points
+-- - Simplified of consecutive duplicated points
-- Ensuring:
-- - No input vertexes are discarded (except consecutive repeated ones)
-- - Output geometry type matches input
--
-- Returns NULL on failure.
---
+--
-- Requires: GEOS-3.3.0
-- Availability: 2.0.0
CREATE OR REPLACE FUNCTION ST_CleanGeometry(geometry)
@@ -3532,7 +3532,7 @@
--
-- Note that multi-part geometries will be returned exploded,
-- no matter relation to blade.
---
+--
-- Availability: 2.0.0
--
CREATE OR REPLACE FUNCTION ST_Split(geom1 geometry, geom2 geometry)
@@ -3554,7 +3554,7 @@
--
-- The paths themselves are given in the direction of the
-- first geometry.
---
+--
-- Availability: 2.0.0
-- Requires GEOS >= 3.3.0
--
@@ -3630,8 +3630,8 @@
--
-- If a tolerance is given it will be used to snap the input points
-- each-other.
---
--
+--
-- Availability: 2.1.0
-- Requires GEOS >= 3.4.0
--
@@ -3652,7 +3652,7 @@
-- By default, the diagram will be extended to an envelope larger than the
-- input points.
--
--- If a second geometry is supplied, the diagram will be extended to fill the
+-- If a second geometry is supplied, the diagram will be extended to fill the
-- envelope of the second geometry, unless that is smaller than the default
-- envelope.
--
@@ -3986,7 +3986,7 @@
RETURNS boolean
AS 'SELECT $1 && $2 AND _ST_Intersects($1,$2)'
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
-
+
-- PostGIS equivalent function: crosses(geom1 geometry, geom2 geometry)
CREATE OR REPLACE FUNCTION _ST_Crosses(geom1 geometry, geom2 geometry)
RETURNS boolean
@@ -4109,8 +4109,8 @@
AS 'MODULE_PATHNAME', 'centroid'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
COST 100;
-
+
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION ST_GeometricMedian(g geometry, tolerance float8 DEFAULT NULL, max_iter int DEFAULT 10000, fail_if_not_converged boolean DEFAULT false)
RETURNS geometry
@@ -4157,11 +4157,11 @@
AS 'SELECT $1 ~= $2 AND _ST_Equals($1,$2)'
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
--- Deprecation in 1.2.3
--- TODO: drop in 2.0.0 !
-CREATE OR REPLACE FUNCTION Equals(geom1 geometry, geom2 geometry)
- RETURNS boolean
- AS 'MODULE_PATHNAME','ST_Equals'
+-- Deprecation in 1.2.3
+-- TODO: drop in 2.0.0 !
+CREATE OR REPLACE FUNCTION Equals(geom1 geometry, geom2 geometry)
+ RETURNS boolean
+ AS 'MODULE_PATHNAME','ST_Equals'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-----------------------------------------------------------------------
@@ -4262,7 +4262,7 @@
LANGUAGE 'c' IMMUTABLE _PARALLEL
COST 2500;
--- ST_AsGML(version, geom) / precision=15
+-- ST_AsGML(version, geom) / precision=15
-- Availability: 1.3.2
-- ST_AsGML(version, geom, precision)
-- Availability: 1.3.2
@@ -4496,14 +4496,14 @@
AS 'MODULE_PATHNAME','LWGEOM_asBinary'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
COST 10;
-
+
-- PostGIS equivalent of old function: AsBinary(geometry)
CREATE OR REPLACE FUNCTION ST_AsBinary(geometry)
RETURNS bytea
AS 'MODULE_PATHNAME','LWGEOM_asBinary'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
COST 10;
-
+
-- PostGIS equivalent function: AsText(geometry)
CREATE OR REPLACE FUNCTION ST_AsText(geometry)
RETURNS TEXT
@@ -4534,13 +4534,13 @@
RETURNS geometry
AS 'MODULE_PATHNAME','LWGEOM_from_text'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+
-- PostGIS equivalent function: ST_GeometryFromText(text)
-- SQL/MM alias for ST_GeomFromText
CREATE OR REPLACE FUNCTION ST_WKTToSQL(text)
RETURNS geometry
AS 'MODULE_PATHNAME','LWGEOM_from_text'
- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
+ LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 1.2.2
CREATE OR REPLACE FUNCTION ST_PointFromText(text)
@@ -4986,13 +4986,13 @@
CREATE OR REPLACE FUNCTION _ST_MaxDistance(geom1 geometry, geom2 geometry)
RETURNS float8
AS 'MODULE_PATHNAME', 'LWGEOM_maxdistance2d_linestring'
- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+ LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
+
-- Availability: 1.5.0
CREATE OR REPLACE FUNCTION ST_MaxDistance(geom1 geometry, geom2 geometry)
RETURNS float8
AS 'SELECT _ST_MaxDistance(ST_ConvexHull($1), ST_ConvexHull($2))'
- LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
+ LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
CREATE OR REPLACE FUNCTION ST_ClosestPoint(geom1 geometry, geom2 geometry)
RETURNS geometry
@@ -5012,18 +5012,18 @@
CREATE OR REPLACE FUNCTION ST_LongestLine(geom1 geometry, geom2 geometry)
RETURNS geometry
AS 'SELECT _ST_LongestLine(ST_ConvexHull($1), ST_ConvexHull($2))'
- LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
+ LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
CREATE OR REPLACE FUNCTION _ST_DFullyWithin(geom1 geometry, geom2 geometry,float8)
RETURNS boolean
AS 'MODULE_PATHNAME', 'LWGEOM_dfullywithin'
- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
+ LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
CREATE OR REPLACE FUNCTION ST_DFullyWithin(geom1 geometry, geom2 geometry, float8)
RETURNS boolean
AS 'SELECT $1 && ST_Expand($2,$3) AND $2 && ST_Expand($1,$3) AND _ST_DFullyWithin(ST_ConvexHull($1), ST_ConvexHull($2), $3)'
- LANGUAGE 'sql' IMMUTABLE;
-
+ LANGUAGE 'sql' IMMUTABLE;
+
-- Availability: 2.2.0
CREATE OR REPLACE FUNCTION ST_SwapOrdinates(geom geometry, ords cstring)
RETURNS geometry
@@ -5038,7 +5038,7 @@
RETURNS geometry
AS 'MODULE_PATHNAME', 'ST_FlipCoordinates'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
- COST 25;
+ COST 25;
--
-- SFSQL 1.1
@@ -5151,12 +5151,12 @@
-- New helper function so we can keep list of valid geometry types in one place --
-- Maps old names to pramsey beautiful names but can take old name or new name as input
-- By default returns new name but can be overridden to return old name for old constraint like support
-CREATE OR REPLACE FUNCTION postgis_type_name(geomname varchar, coord_dimension integer, use_new_name boolean DEFAULT true)
+CREATE OR REPLACE FUNCTION postgis_type_name(geomname varchar, coord_dimension integer, use_new_name boolean DEFAULT true)
RETURNS varchar
AS
$$
SELECT CASE WHEN $3 THEN new_name ELSE old_name END As geomname
- FROM
+ FROM
( VALUES
('GEOMETRY', 'Geometry', 2) ,
('GEOMETRY', 'GeometryZ', 3) ,
@@ -5165,67 +5165,67 @@
('GEOMETRYCOLLECTION', 'GeometryCollectionZ', 3) ,
('GEOMETRYCOLLECTIONM', 'GeometryCollectionM', 3) ,
('GEOMETRYCOLLECTION', 'GeometryCollectionZM', 4) ,
-
+
('POINT', 'Point',2) ,
('POINTM','PointM',3) ,
('POINT', 'PointZ',3) ,
('POINT', 'PointZM',4) ,
-
+
('MULTIPOINT','MultiPoint',2) ,
('MULTIPOINT','MultiPointZ',3) ,
('MULTIPOINTM','MultiPointM',3) ,
('MULTIPOINT','MultiPointZM',4) ,
-
+
('POLYGON', 'Polygon',2) ,
('POLYGON', 'PolygonZ',3) ,
('POLYGONM', 'PolygonM',3) ,
('POLYGON', 'PolygonZM',4) ,
-
+
('MULTIPOLYGON', 'MultiPolygon',2) ,
('MULTIPOLYGON', 'MultiPolygonZ',3) ,
('MULTIPOLYGONM', 'MultiPolygonM',3) ,
('MULTIPOLYGON', 'MultiPolygonZM',4) ,
-
+
('MULTILINESTRING', 'MultiLineString',2) ,
('MULTILINESTRING', 'MultiLineStringZ',3) ,
('MULTILINESTRINGM', 'MultiLineStringM',3) ,
('MULTILINESTRING', 'MultiLineStringZM',4) ,
-
+
('LINESTRING', 'LineString',2) ,
('LINESTRING', 'LineStringZ',3) ,
('LINESTRINGM', 'LineStringM',3) ,
('LINESTRING', 'LineStringZM',4) ,
-
+
('CIRCULARSTRING', 'CircularString',2) ,
('CIRCULARSTRING', 'CircularStringZ',3) ,
('CIRCULARSTRINGM', 'CircularStringM',3) ,
('CIRCULARSTRING', 'CircularStringZM',4) ,
-
+
('COMPOUNDCURVE', 'CompoundCurve',2) ,
('COMPOUNDCURVE', 'CompoundCurveZ',3) ,
('COMPOUNDCURVEM', 'CompoundCurveM',3) ,
('COMPOUNDCURVE', 'CompoundCurveZM',4) ,
-
+
('CURVEPOLYGON', 'CurvePolygon',2) ,
('CURVEPOLYGON', 'CurvePolygonZ',3) ,
('CURVEPOLYGONM', 'CurvePolygonM',3) ,
('CURVEPOLYGON', 'CurvePolygonZM',4) ,
-
+
('MULTICURVE', 'MultiCurve',2 ) ,
('MULTICURVE', 'MultiCurveZ',3 ) ,
('MULTICURVEM', 'MultiCurveM',3 ) ,
('MULTICURVE', 'MultiCurveZM',4 ) ,
-
+
('MULTISURFACE', 'MultiSurface', 2) ,
('MULTISURFACE', 'MultiSurfaceZ', 3) ,
('MULTISURFACEM', 'MultiSurfaceM', 3) ,
('MULTISURFACE', 'MultiSurfaceZM', 4) ,
-
+
('POLYHEDRALSURFACE', 'PolyhedralSurface',2) ,
('POLYHEDRALSURFACE', 'PolyhedralSurfaceZ',3) ,
('POLYHEDRALSURFACEM', 'PolyhedralSurfaceM',3) ,
('POLYHEDRALSURFACE', 'PolyhedralSurfaceZM',4) ,
-
+
('TRIANGLE', 'Triangle',2) ,
('TRIANGLE', 'TriangleZ',3) ,
('TRIANGLEM', 'TriangleM',3) ,
@@ -5281,7 +5281,7 @@
-- Deprecation in 2.2.0
CREATE OR REPLACE FUNCTION postgis_constraint_type(geomschema text, geomtable text, geomcolumn text) RETURNS varchar AS
$$
-SELECT replace(split_part(s.consrc, '''', 2), ')', '')::varchar
+SELECT replace(split_part(s.consrc, '''', 2), ')', '')::varchar
FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
WHERE n.nspname = $1
AND c.relname = $2
@@ -5297,7 +5297,7 @@
-- Availability: 2.0.0
-- Changed: 2.1.8 significant performance improvement for constraint based columns
-- Changed: 2.2.0 get rid of scheman, table, column cast to improve performance
-CREATE OR REPLACE VIEW geometry_columns AS
+CREATE OR REPLACE VIEW geometry_columns AS
SELECT current_database()::character varying(256) AS f_table_catalog,
n.nspname AS f_table_schema,
c.relname AS f_table_name,
@@ -5313,25 +5313,25 @@
s.conrelid,
s.conkey, replace(split_part(s.consrc, ''''::text, 2), ')'::text, ''::text) As type
FROM pg_constraint AS s
- WHERE s.consrc ~~* '%geometrytype(% = %'::text
-
+ WHERE s.consrc ~~* '%geometrytype(% = %'::text
+
) st ON st.connamespace = n.oid AND st.conrelid = c.oid AND (a.attnum = ANY (st.conkey))
LEFT JOIN ( SELECT s.connamespace,
s.conrelid,
s.conkey, replace(split_part(s.consrc, ' = '::text, 2), ')'::text, ''::text)::integer As ndims
FROM pg_constraint AS s
WHERE s.consrc ~~* '%ndims(% = %'::text
-
+
) sn ON sn.connamespace = n.oid AND sn.conrelid = c.oid AND (a.attnum = ANY (sn.conkey))
LEFT JOIN ( SELECT s.connamespace,
s.conrelid,
s.conkey, replace(replace(split_part(s.consrc, ' = '::text, 2), ')'::text, ''::text), '('::text, ''::text)::integer As srid
FROM pg_constraint AS s
WHERE s.consrc ~~* '%srid(% = %'::text
-
+
) sr ON sr.connamespace = n.oid AND sr.conrelid = c.oid AND (a.attnum = ANY (sr.conkey))
- WHERE (c.relkind = ANY (ARRAY['r'::"char", 'v'::"char", 'm'::"char", 'f'::"char"]))
- AND NOT c.relname = 'raster_columns'::name AND t.typname = 'geometry'::name
+ WHERE (c.relkind = ANY (ARRAY['r'::"char", 'v'::"char", 'm'::"char", 'f'::"char"]))
+ AND NOT c.relname = 'raster_columns'::name AND t.typname = 'geometry'::name
AND NOT pg_is_other_temp_schema(c.relnamespace) AND has_table_privilege(c.oid, 'SELECT'::text);
@@ -5360,12 +5360,12 @@
AS 'MODULE_PATHNAME', 'distance3d'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
-
+
CREATE OR REPLACE FUNCTION ST_3DMaxDistance(geom1 geometry, geom2 geometry)
RETURNS float8
AS 'MODULE_PATHNAME', 'LWGEOM_maxdistance3d'
LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ COST 100;
CREATE OR REPLACE FUNCTION ST_3DClosestPoint(geom1 geometry, geom2 geometry)
RETURNS geometry
@@ -5384,25 +5384,25 @@
AS 'MODULE_PATHNAME', 'LWGEOM_longestline3d'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
-
+
CREATE OR REPLACE FUNCTION _ST_3DDWithin(geom1 geometry, geom2 geometry,float8)
RETURNS boolean
AS 'MODULE_PATHNAME', 'LWGEOM_dwithin3d'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
-
+
CREATE OR REPLACE FUNCTION ST_3DDWithin(geom1 geometry, geom2 geometry,float8)
RETURNS boolean
AS 'SELECT $1 && ST_Expand($2,$3) AND $2 && ST_Expand($1,$3) AND _ST_3DDWithin($1, $2, $3)'
LANGUAGE 'sql' IMMUTABLE
COST 100;
-
+
CREATE OR REPLACE FUNCTION _ST_3DDFullyWithin(geom1 geometry, geom2 geometry,float8)
RETURNS boolean
AS 'MODULE_PATHNAME', 'LWGEOM_dfullywithin3d'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
-
+
CREATE OR REPLACE FUNCTION ST_3DDFullyWithin(geom1 geometry, geom2 geometry,float8)
RETURNS boolean
AS 'SELECT $1 && ST_Expand($2,$3) AND $2 && ST_Expand($1,$3) AND _ST_3DDFullyWithin($1, $2, $3)'
@@ -5414,14 +5414,14 @@
AS 'MODULE_PATHNAME','intersects3d'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
-
+
CREATE OR REPLACE FUNCTION ST_3DIntersects(geom1 geometry, geom2 geometry)
RETURNS boolean
AS 'SELECT $1 && $2 AND _ST_3DIntersects($1, $2)'
LANGUAGE 'sql' IMMUTABLE
COST 100;
-
-
+
+
---------------------------------------------------------------
-- SQL-MM
---------------------------------------------------------------
@@ -5430,7 +5430,7 @@
RETURNS smallint
AS 'MODULE_PATHNAME', 'LWGEOM_ndims'
LANGUAGE 'c' IMMUTABLE STRICT
- COST 5;
+ COST 5;
--
-- SQL-MM
--
@@ -5464,7 +5464,7 @@
RETURNS geometry
AS 'MODULE_PATHNAME', 'LWGEOM_line_desegmentize'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+
-- Availability: 1.5.0
CREATE OR REPLACE FUNCTION _ST_OrderingEquals(GeometryA geometry, GeometryB geometry)
RETURNS boolean
@@ -5475,11 +5475,11 @@
-- Availability: 1.3.0
CREATE OR REPLACE FUNCTION ST_OrderingEquals(GeometryA geometry, GeometryB geometry)
RETURNS boolean
- AS $$
+ AS $$
SELECT $1 ~= $2 AND _ST_OrderingEquals($1, $2)
- $$
- LANGUAGE 'sql' IMMUTABLE;
-
+ $$
+ LANGUAGE 'sql' IMMUTABLE;
+
-------------------------------------------------------------------------------
-- SQL/MM - SQL Functions on type ST_Point
-------------------------------------------------------------------------------
@@ -5488,23 +5488,23 @@
CREATE OR REPLACE FUNCTION ST_Point(float8, float8)
RETURNS geometry
AS 'MODULE_PATHNAME', 'LWGEOM_makepoint'
- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+ LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
+
-- PostGIS equivalent function: ST_MakePolygon(Geometry geometry)
CREATE OR REPLACE FUNCTION ST_Polygon(geometry, int)
RETURNS geometry
- AS $$
+ AS $$
SELECT ST_SetSRID(ST_MakePolygon($1), $2)
- $$
- LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
-
+ $$
+ LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
+
-- PostGIS equivalent function: GeomFromWKB(WKB bytea))
-- Note: Defaults to an SRID=-1, not 0 as per SQL/MM specs.
CREATE OR REPLACE FUNCTION ST_WKBToSQL(WKB bytea)
RETURNS geometry
AS 'MODULE_PATHNAME','LWGEOM_from_WKB'
- LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+ LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
+
---
-- Linear referencing functions
---
@@ -5513,7 +5513,7 @@
RETURNS geometry
AS 'MODULE_PATHNAME', 'ST_LocateBetween'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-
+
-- Availability: 2.0.0
CREATE OR REPLACE FUNCTION ST_LocateAlong(Geometry geometry, Measure float8, LeftRightOffset float8 default 0.0)
RETURNS geometry
@@ -5550,7 +5550,7 @@
CREATE OR REPLACE FUNCTION _st_concavehull(param_inputgeom geometry)
RETURNS geometry AS
$$
- DECLARE
+ DECLARE
vexhull GEOMETRY;
var_resultgeom geometry;
var_inputgeom geometry;
@@ -5561,7 +5561,7 @@
var_tempgeom geometry;
scale_factor integer := 1;
i integer;
-
+
BEGIN
-- First compute the ConvexHull of the geometry
@@ -5587,20 +5587,20 @@
cavering := ST_Collect(
ARRAY(
- SELECT
+ SELECT
ST_ClosestPoint(var_inputgeom, pt ) As the_geom
FROM (
SELECT ST_PointN(vexring, n ) As pt, n
- FROM
+ FROM
generate_series(1, ST_NPoints(vexring) ) As n
) As pt
-
+
)
)
- ;
-
+ ;
- var_resultgeom := ST_MakeLine(geom)
+
+ var_resultgeom := ST_MakeLine(geom)
FROM ST_Dump(cavering) As foo;
IF ST_IsSimple(var_resultgeom) THEN
@@ -5610,16 +5610,16 @@
--RAISE NOTICE 'is not Simple: %', var_resultgeom;
var_resultgeom := ST_ConvexHull(var_resultgeom);
END IF;
-
+
IF scale_factor > 1 THEN -- scale the result back
var_resultgeom := ST_Scale(var_resultgeom, 1/scale_factor, 1/scale_factor);
END IF;
RETURN var_resultgeom;
-
+
END;
$$
LANGUAGE plpgsql IMMUTABLE STRICT _PARALLEL;
-
+
CREATE OR REPLACE FUNCTION ST_ConcaveHull(param_geom geometry, param_pctconvex float, param_allow_holes boolean DEFAULT false) RETURNS geometry AS
$$
DECLARE
@@ -5639,7 +5639,7 @@
BEGIN
-- We start with convex hull as our base
var_resultgeom := var_convhull;
-
+
IF param_pctconvex = 1 THEN
return var_resultgeom;
ELSIF ST_GeometryType(var_param_geom) = 'ST_Polygon' THEN -- it is as concave as it is going to get
@@ -5655,7 +5655,7 @@
var_enline := ST_Boundary(ST_Envelope(var_param_geom));
var_buf := ST_Length(var_enline)/1000.0;
IF ST_GeometryType(var_param_geom) = 'ST_MultiPoint' AND ST_NumGeometries(var_param_geom) BETWEEN 4 and 200 THEN
- -- we make polygons out of points since they are easier to cave in.
+ -- we make polygons out of points since they are easier to cave in.
-- Note we limit to between 4 and 200 points because this process is slow and gets quadratically slow
var_buf := sqrt(ST_Area(var_convhull)*0.8/(ST_NumGeometries(var_param_geom)*ST_NumGeometries(var_param_geom)));
var_atempgeoms := ARRAY(SELECT geom FROM ST_DumpPoints(var_param_geom));
@@ -5665,7 +5665,7 @@
-- fuse near neighbors together
SELECT DISTINCT ON (i) i, ST_Distance(var_atempgeoms[i],var_atempgeoms[j]), ST_Buffer(ST_MakeLine(var_atempgeoms[i], var_atempgeoms[j]) , var_buf*5, 'quad_segs=3') As geom
FROM generate_series(1,array_upper(var_atempgeoms, 1)) As i
- INNER JOIN generate_series(1,array_upper(var_atempgeoms, 1)) As j
+ INNER JOIN generate_series(1,array_upper(var_atempgeoms, 1)) As j
ON (
NOT ST_Intersects(var_atempgeoms[i],var_atempgeoms[j])
AND ST_DWithin(var_atempgeoms[i],var_atempgeoms[j], var_buf*10)
@@ -5674,10 +5674,10 @@
-- catch the ones with no near neighbors
SELECT i, 0, ST_Buffer(var_atempgeoms[i] , var_buf*10, 'quad_segs=3') As geom
FROM generate_series(1,array_upper(var_atempgeoms, 1)) As i
- LEFT JOIN generate_series(ceiling(array_upper(var_atempgeoms,1)/2)::integer,array_upper(var_atempgeoms, 1)) As j
+ LEFT JOIN generate_series(ceiling(array_upper(var_atempgeoms,1)/2)::integer,array_upper(var_atempgeoms, 1)) As j
ON (
NOT ST_Intersects(var_atempgeoms[i],var_atempgeoms[j])
- AND ST_DWithin(var_atempgeoms[i],var_atempgeoms[j], var_buf*10)
+ AND ST_DWithin(var_atempgeoms[i],var_atempgeoms[j], var_buf*10)
)
WHERE j IS NULL
ORDER BY 1, 2
@@ -5691,7 +5691,7 @@
END IF;
return var_param_geom;
ELSIF ST_IsValid(var_tempgeom) THEN
- var_param_geom := ST_ForceSFS(ST_Intersection(var_tempgeom, var_convhull));
+ var_param_geom := ST_ForceSFS(ST_Intersection(var_tempgeom, var_convhull));
END IF;
END IF;
@@ -5717,16 +5717,16 @@
FOR i in 1 .. 4 LOOP
var_geoms[i] := ST_MakePolygon(ST_MakeLine(ARRAY[ST_PointN(var_enline,i), ST_PointN(var_enline,i+1), var_cent, ST_PointN(var_enline,i)]));
var_geoms[i] := ST_ForceSFS(ST_Intersection(var_param_geom, ST_Buffer(var_geoms[i],var_buf)));
- IF ST_IsValid(var_geoms[i]) THEN
-
+ IF ST_IsValid(var_geoms[i]) THEN
+
ELSE
var_geoms[i] := ST_BuildArea(ST_MakeLine(ARRAY[ST_PointN(var_enline,i), ST_PointN(var_enline,i+1), var_cent, ST_PointN(var_enline,i)]));
- END IF;
+ END IF;
END LOOP;
- var_tempgeom := ST_Union(ARRAY[ST_ConvexHull(var_geoms[1]), ST_ConvexHull(var_geoms[2]) , ST_ConvexHull(var_geoms[3]), ST_ConvexHull(var_geoms[4])]);
+ var_tempgeom := ST_Union(ARRAY[ST_ConvexHull(var_geoms[1]), ST_ConvexHull(var_geoms[2]) , ST_ConvexHull(var_geoms[3]), ST_ConvexHull(var_geoms[4])]);
--RAISE NOTICE 'Curr vex % ', ST_AsText(var_tempgeom);
IF ST_Area(var_tempgeom) <= var_newarea AND ST_IsValid(var_tempgeom) THEN --AND ST_GeometryType(var_tempgeom) ILIKE '%Polygon'
-
+
var_tempgeom := ST_Buffer(ST_ConcaveHull(var_geoms[1],least(param_pctconvex + param_pctconvex/var_div),true),var_buf, 'quad_segs=2');
FOR i IN 1 .. 4 LOOP
var_geoms[i] := ST_Buffer(ST_ConcaveHull(var_geoms[i],least(param_pctconvex + param_pctconvex/var_div),true), var_buf, 'quad_segs=2');
@@ -5735,7 +5735,7 @@
ELSE
RAISE NOTICE 'Not valid % %', i, ST_AsText(var_tempgeom);
var_tempgeom := ST_Union(var_tempgeom, ST_ConvexHull(var_geoms[i]));
- END IF;
+ END IF;
END LOOP;
--RAISE NOTICE 'Curr concave % ', ST_AsText(var_tempgeom);
@@ -5755,7 +5755,7 @@
var_resultgeom := ST_Buffer(var_tempgeom,var_buf, 'quad_segs=2');
END IF;
END IF;
- IF param_allow_holes = false THEN
+ IF param_allow_holes = false THEN
-- only keep exterior ring since we do not want holes
var_resultgeom := ST_MakePolygon(ST_ExteriorRing(var_resultgeom));
END IF;
@@ -5781,7 +5781,7 @@
RETURNS TEXT
AS 'MODULE_PATHNAME','LWGEOM_asX3D'
LANGUAGE 'c' IMMUTABLE;
-
+
-- ST_AsX3D(geom, precision, options)
CREATE OR REPLACE FUNCTION ST_AsX3D(geom geometry, maxdecimaldigits integer DEFAULT 15, options integer DEFAULT 0)
RETURNS TEXT
More information about the postgis-tickets
mailing list