SpatialDB Advisor
I am continuing my looking at PostGIS and developing new functions for Oracle that plug-gaps identified in PostGIS. Much of this has been wrapping existing functions in my existing GEOM PL/SQL package, but some has involved developing new functions.
Today, because of a comment on ST_Affine by Regina Obe, I added two additional wrappers for my existing TOLERANCE function so that someone used to using PostGIS can easily adapt to Oracle Spatial.
Now, PostGIS’s ST_SnapToGrid function actually has four variants as show in the online documentation. I have chosen only to implement the second and third of these via the following wrappers over an amended Tolerance function.
Function Tolerance (
p_geometry in MDSYS.SDO_Geometry,
p_dimarray in MDSYS.SDO_Dim_Array )
return MDSYS.SDO_Geometry deterministic;
Now, let’s conduct some tests.
Firstly, let’s look at the single tolerance/size versions of the Tolerance/ST_SnapToGrid functions. (Note the use of the mdsys.OGC_LineStringFromText wrapper function to generate an ST_LINESTRING object and note that the output is pure Oracle: in particular note the SDO_GEOMETRY object inside the MDSYS.ST_LINESTRING object output by the ST_SnapToGrid function.)
SELECT GEOM.Tolerance(a.geom,0.005) as geom
FROM (SELECT mdsys.SDO_Geometry('LINESTRING(1.12345 1.3445,2.43534 2.03998398)') as geom
FROM dual) a;
Secondly, and finally, the two tolerance parameter versions (note, this time we output the data as WKT).
SELECT GEOM.Tolerance(a.geom,0.005,0.05).Get_WKT() as geom
FROM (SELECT mdsys.SDO_Geometry('LINESTRING(1.12345 1.3445,2.43534 2.03998398)') as geom
FROM dual) a;
Note that the different X and Y tolerances were correctly applied and are visible in the output coordinate values.
I hope this is of use to someone.


















<<Generating random point data >>Implementing a SetPoint/ST_SetPoint function in Oracle