------------------------------------------------------------------------------
CREATE CAST (raster AS box3d)
- WITH FUNCTION box3d(raster) AS IMPLICIT;
+ WITH FUNCTION box3d(raster) AS ASSIGNMENT;
CREATE CAST (raster AS geometry)
- WITH FUNCTION st_convexhull(raster) AS IMPLICIT;
+ WITH FUNCTION st_convexhull(raster) AS ASSIGNMENT;
CREATE CAST (raster AS bytea)
- WITH FUNCTION bytea(raster) AS IMPLICIT;
+ WITH FUNCTION bytea(raster) AS ASSIGNMENT;
------------------------------------------------------------------------------
-- GiST index OPERATOR support functions
CREATE OR REPLACE FUNCTION st_intersects(rast raster, geom geometry, nband integer DEFAULT NULL)
RETURNS boolean
- AS $$ SELECT $1 && $2 AND _st_intersects($1, $2, $3) $$
+ AS $$ SELECT $1::geometry && $2 AND _st_intersects($1, $2, $3) $$
LANGUAGE 'SQL' IMMUTABLE
COST 1000;
CREATE OR REPLACE FUNCTION st_intersects(rast raster, nband integer, geom geometry)
RETURNS boolean
- AS $$ SELECT $1 && $3 AND _st_intersects($1, $3, $2) $$
+ AS $$ SELECT $1::geometry && $3 AND _st_intersects($1, $3, $2) $$
LANGUAGE 'SQL' IMMUTABLE
COST 1000;
-- This function can not be STRICT
CREATE OR REPLACE FUNCTION st_intersects(geom geometry, rast raster, nband integer DEFAULT NULL)
RETURNS boolean AS
- $$ SELECT $1 && $2 AND _st_intersects($1, $2, $3); $$
+ $$ SELECT $1 && $2::geometry AND _st_intersects($1, $2, $3); $$
LANGUAGE 'SQL' IMMUTABLE
COST 1000;
DROP FUNCTION IF EXISTS st_contain(raster, raster); **/
-- drop st_bytea
-DROP CAST IF EXISTS (raster as bytea);
+DROP CAST IF EXISTS (raster AS bytea);
DROP FUNCTION IF EXISTS st_bytea(raster);
CREATE OR REPLACE FUNCTION bytea(raster)
AS 'MODULE_PATHNAME', 'RASTER_to_bytea'
LANGUAGE 'C' IMMUTABLE STRICT;
CREATE CAST (raster AS bytea)
- WITH FUNCTION bytea(raster) AS IMPLICIT;
+ WITH FUNCTION bytea(raster) AS ASSIGNMENT;
-- drop box2d
DROP CAST IF EXISTS (raster AS box2d);
DROP FUNCTION IF EXISTS box2d(raster);
--- create box3d cast if it does not exist --
+-- create box3d cast if it does not exist
+#if POSTGIS_PGSQL_VERSION >= 90
-- If we are running 9.0+ we can use DO plpgsql to check
-- and only create if not exists so no need to force a drop
-- that way if people are using it, we will not mess them up
-#if POSTGIS_PGSQL_VERSION >= 90
DO language 'plpgsql' $$DECLARE r record;
BEGIN
- IF NOT EXISTS(SELECT cs.typname As source
+ IF NOT EXISTS(SELECT cs.typname AS source
FROM pg_cast AS ca
INNER JOIN pg_type AS cs ON ca.castsource = cs.oid
INNER JOIN pg_type AS ct ON ca.casttarget = ct.oid
WHERE cs.typname = 'raster' AND ct.typname = 'box3d') THEN
CREATE OR REPLACE FUNCTION box3d(raster)
RETURNS box3d
- AS 'select box3d(st_convexhull($1))'
+ AS 'SELECT box3d(st_convexhull($1))'
LANGUAGE 'SQL' IMMUTABLE STRICT;
CREATE CAST (raster AS box3d)
- WITH FUNCTION box3d(raster) AS IMPLICIT;
+ WITH FUNCTION box3d(raster) AS ASSIGNMENT;
END IF;
END$$;
#endif
--- if we are running 8.4 we need to use brute force
#if POSTGIS_PGSQL_VERSION < 90
-DROP CAST IF EXISTS (raster as box3d);
+-- if we are running 8.4 we need to use brute force
+DROP CAST IF EXISTS (raster AS box3d);
CREATE OR REPLACE FUNCTION box3d(raster)
RETURNS box3d
- AS 'select box3d(st_convexhull($1))'
+ AS 'SELECT box3d(st_convexhull($1))'
LANGUAGE 'SQL' IMMUTABLE STRICT;
CREATE CAST (raster AS box3d)
- WITH FUNCTION box3d(raster) AS IMPLICIT;
+ WITH FUNCTION box3d(raster) AS ASSIGNMENT;
#endif
+
+-- make geometry cast ASSIGNMENT
+DROP CAST IF EXISTS (raster AS geometry);
+CREATE CAST (raster AS geometry)
+ WITH FUNCTION st_convexhull(raster) AS ASSIGNMENT;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_above(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile |>> b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_below(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile <<| b.tile;
FROM rt_bytea_test
WHERE
encode(bytea(rast), 'hex') != encode(rast::bytea, 'hex')
- OR
- encode(bytea(rast), 'hex') != encode(rast, 'hex')
;
-----------------------------------------------------------------------
FROM rt_bytea_test
WHERE
encode(bytea(rast), 'base64') != encode(rast::bytea, 'base64')
- OR
- encode(bytea(rast), 'base64') != encode(rast, 'base64')
;
-----------------------------------------------------------------------
FROM rt_bytea_test
WHERE
encode(st_asbinary(rast), 'base64') != encode(rast::bytea, 'base64')
- OR
- encode(st_asbinary(rast), 'base64') != encode(rast, 'base64')
;
-- Cleanup
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_contain(b.tile, a.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND b.tile ~ a.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_contained(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile @ b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_left(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile << b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_overabove(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile |&> b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_overbelow(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile &<| b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_overlap(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile && b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_overleft(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile &< b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_overright(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile &> b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_right(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile >> b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND raster_same(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_grid_test b
WHERE b.x = 7 and b.y = 7
AND raster_same(a.tile, b.tile);
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_query_test b
WHERE b.x = 1 and b.y = 1
AND a.tile ~= b.tile;
max(a.x) as xmax,
min(a.y) as ymin,
max(a.y) as ymax,
- st_extent(a.tile)
+ st_extent(a.tile::geometry)
FROM rt_gist_grid_test a, rt_gist_grid_test b
WHERE b.x = 7 and b.y = 7
AND a.tile ~= b.tile;