Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread
Message: 98244
BY: David Adler (dadler)
DATE: 2012-08-15 14:57
SUBJECT: RE: DB2 GeoSpatial Transform Group

 

If your code worked before on an earlier DB2 version, the problem could be due to changes in DB2 V9.7 for the default casting support which was changed to improve SQL compatibility with other DBMS.

I was able to get this to work by creating a new transform group specifically for ST_Polygon with the following DDL:

DROP TRANSFORM wkb_poly_trans FOR db2gse.ST_Polygon;

-- *-----------------------------------------------------------------------
-- * transform group for well-known binary for polygons
-- *-----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION test.PolyAsWKB ( geometry db2gse.ST_Polygon )
RETURNS BLOB(2147483647)
SPECIFIC test.PolyAsWKB
LANGUAGE SQL
DETERMINISTIC
NO EXTERNAL ACTION
CONTAINS SQL
RETURN geometry..ST_AsBinary()
;

-- Specify SRID to be used in ST_Polygon constructor
CREATE OR REPLACE FUNCTION test.PolyFromWKB ( wkb BLOB(2147483647) )
RETURNS db2gse.st_polygon
SPECIFIC test.PolyFromWKB
LANGUAGE SQL
DETERMINISTIC
NO EXTERNAL ACTION
READS SQL DATA
RETURN db2gse.ST_Polygon(wkb, 1003)
;

CREATE TRANSFORM FOR db2gse.ST_Polygon wkb_poly_trans
( FROM SQL WITH FUNCTION test.PolyAsWKB(db2gse.ST_Polygon),
TO SQL WITH FUNCTION test.PolyFromWKB(BLOB(2147483647)) )
;


Thread View

Thread Author Date
DB2 GeoSpatial Transform GroupBrandon Medenwald2012-07-30 16:08
      RE: DB2 GeoSpatial Transform GroupPraveen Devarao2012-07-30 16:46
            RE: DB2 GeoSpatial Transform GroupBrandon Medenwald2012-07-30 19:51
            RE: DB2 GeoSpatial Transform GroupBrandon Medenwald2012-08-13 13:58
                  RE: DB2 GeoSpatial Transform GroupDavid Adler2012-08-13 14:29
                        RE: DB2 GeoSpatial Transform GroupBrandon Medenwald2012-08-13 15:16
                              RE: DB2 GeoSpatial Transform GroupDavid Adler2012-08-13 15:49
                                    RE: DB2 GeoSpatial Transform GroupBrandon Medenwald2012-08-13 15:55
                                    RE: DB2 GeoSpatial Transform GroupBrandon Medenwald2012-08-14 14:07
      RE: DB2 GeoSpatial Transform GroupDavid Adler2012-08-15 14:57

Post a followup to this message