Top 5 Recent Articles
ARTICLES CATEGORIES
- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)
LINEAR (LRS)
UPDATED: This package of functions underwent a revamp in early July 2012. In that revamp:
- ST_Locate_Point was overhauled to correctly handle both distance based segmentation of 2D lines as well as Measured geometries (p_value_Type parameter now fully handled).
- ST prefixes added to public functions._
- T_Vector Type enhanced
- ST_GetVector renamed to ST_Vectorize
- Bugs fixed in ST_Split
- Added:
ST_Offset_Geom_Segment
ST_Reset_Measure
ST_Start_Measure
ST_End_Measure
ST_Measure_Range
ST_Measure_To_Percentage
ST_Percentage_To_Measure
ST_Scale_Geom_Segment
ST_getMeasureDimension
ST_Reverse_Measure
I have written a PL/SQL package called LINEAR that could be used, in many situations, to provide Enterprise SDO_LRS functionality for Oracle Locator based deployments.
It does not implement everything that SDO_LRS does.
If you want something in particular, please look at my re-write of the source code as Oracle Objects on this site.
Additionally it focuses mainly on projected (not long/lat) data, so if you use with geodetic data do so at your own risk.
Required Data Types
The LINEAR package requires other Oracle PL/SQL types to exist. See other documentation for a full description of what they do.
DEFINE defaultSchema = '&1' . CREATE TYPE T_GeometrySet; CREATE TYPE T_Geometry; CREATE TYPE T_Vector; CREATE TYPE T_Vertex; CREATE TYPE T_TokenSet; CREATE TYPE T_Tokens; CREATE TYPE T_numbers;
Linear Package Header
DEFINE defaultSchema='&1' . CREATE OR REPLACE PACKAGE LINEAR AUTHID CURRENT_USER AS . TYPE T_Integers IS TABLE OF INTEGER; . TYPE t_VertexSet IS TABLE OF &&defaultSchema..t_Vertex; . TYPE t_VectorSet IS TABLE OF &&defaultSchema..t_Vector; . TYPE T_GeometrySet IS TABLE OF &&defaultSchema..T_Geometry; . /* For Function GetNumRings() */ c_rings_all Constant Pls_Integer := 0; c_rings_outer Constant Pls_Integer := 1; c_rings_inner Constant Pls_Integer := 2; . /** =========================================== Linear Functions **/ /** ---------------------------------------------------------------------------------------- * @function : ST_Split * @precis : A procedure that splits a line geometry at a known point * @version : 1.0 * @description: This procedure will split a linestring or multi-linestring sdo_geometry object * at a supplied (known) point. Normally the point should lie on the linestring at * a vertex or between two vertices but the algorithm used will split a line even if * the point does not lie on the line. Where the point does not lie on the linestring * the algorithm approximates the nearest point on the linestring to the supplied point * and splits it there: the algorithm is ratio based and will not necessarily be accurate * for geodetic data. * The function can be used to return only the split point if p_snap > 0. * @usage : procedure ST_Split( p_geometry in mdsys.sdo_geometry, * p_point in mdsys.sdo_geometry, * p_tolerance in number, * p_out_line1 out mdsys.sdo_geometry, * p_out_line2 out mdsys.sdo_geometry ) * @param : p_geometry : MDSYS.SDO_GEOMETRY : A linestring(2002) or multi-linestring (2006) * @ sdo_geometry object describing the line to be split. * @param : p_point : MDSYS.SDO_GEOMETRY : A point(2001) sdo_geometry object describing the * @ point for splitting the linestring. * @param : p_tolerance : NUMBER : Tolerance value used in mdsys.sdo_geom.sdo_distance function. * @return : p_out_geom1 : MDSYS.SDO_GEOMETRY : First part of split linestring * @return : p_out_geom2 : MDSYS.SDO_GEOMETRY : Second part of split linestring * @param : p_snap : PLS_INTEGER : Value 0 means line is split and two parts are returned. * @ Positive value means split point is returned in p_out_geom1 rather than two halves of line * @param : p_exception : PLS_INTEGER : If set to 1 then an exception will be thrown if any error is discovered, * @ otherwise NULL values are returned. Useful when procesing large SQL statements. * @history : Simon Greener - Jan 2008 - Original coding. * @history : Simon Greener - Dec 2009 - Fixed SRID handling bug for Geodetic data. * @history : Simon Greener - Jun 2010 - Added p_snap and p_exception handling * @copyright : Simon Greener, 2008, 2009, 2010, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ PROCEDURE ST_Split( p_geometry IN mdsys.sdo_geometry, p_point IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.005, p_out_geom1 OUT nocopy mdsys.sdo_geometry, p_out_geom2 OUT nocopy mdsys.sdo_geometry, p_snap IN pls_integer DEFAULT 0, p_exception IN pls_integer DEFAULT 0); . /** * Repackaging of the Split procedure * via overloaded functions */ FUNCTION ST_Split( p_geometry IN mdsys.sdo_geometry, p_point IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN pls_integer DEFAULT 0) RETURN &&defaultSchema..LINEAR.t_GeometrySet pipelined; . /** ---------------------------------------------------------------------------------------- * @function : ST_Split_Geom_Segment * @precis : A procedure that splits a line geometry into possibly two line geometries at a known point * @version : 1.0 * @description: This procedure will split a linestring or multi-linestring sdo_geometry object * at a supplied (known) point. Normally the point should lie on the linestring at * a vertex or between two vertices but the algorithm used will split a line even if * the point does not lie on the line. Where the point does not lie on the linestring * the algorithm approximates the nearest point on the linestring to the supplied point * and splits it there: the algorithm is ratio based and will not necessarily be accurate * for geodetic data. * @usage : procedure ST_Split(p_geometry in mdsys.sdo_geometry, * p_split_measure in mdsys.sdo_geometry, * p_segment_1 out mdsys.sdo_geometry, * p_segment_2 out mdsys.sdo_geometry ) * @param : p_geometry : MDSYS.SDO_GEOMETRY : A linestring(2002) or multi-linestring (2006) * @ sdo_geometry object describing the line to be split. * @param : p_split_measure : measure between start and end of linestring at which the segment should be split. * @return : p_segment_1 : MDSYS.SDO_GEOMETRY : First part of split linestring * @return : p_segment_2 : MDSYS.SDO_GEOMETRY : Second part of split linestring * @history : Simon Greener - Jan 2012 - Implemented wrapper over ST_Split * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ PROCEDURE ST_Split_Geom_Segment( p_geom_segment IN SDO_GEOMETRY, p_split_measure IN NUMBER, p_segment_1 OUT NOCOPY SDO_GEOMETRY, p_segment_2 OUT NOCOPY SDO_GEOMETRY); . FUNCTION ST_Split_Geom_Segment( p_geom_segment IN SDO_GEOMETRY, p_split_measure IN NUMBER) RETURN &&defaultSchema..LINEAR.t_GeometrySet pipelined; . /** ---------------------------------------------------------------------------------------- * @function : ST_Is_Measure_Decreasing * @precis : Checks if the measure values along an LRS segment are decreasing. * @version : 1.0 * @description: Checks whole linestring to make sure all adjacent measures are decreasing in * numerical order. * Returns 'TRUE' if descreasing, 'FALSE' otherwise. * @usage : Function ST_Is_Measure_Decreasing( p_geometry in mdsys.sdo_geometry) * Returns varchar2; * @param : p_geometry : MDSYS.SDO_GEOMETRY : A linestring(2002) or multi-linestring (2006) sdo_geometry * @ object describing the line to be split. * @return : is_increasing : varchar2 : Returns 'TRUE' if decreasing, 'FALSE' otherwise. * @history : Simon Greener - Jan 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Is_Measure_Decreasing(p_geometry IN SDO_GEOMETRY) RETURN VARCHAR2 Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Is_Measure_Increasing * @precis : Checks if the measure values along an LRS segment are increasing (that is, ascending in numerical value). * @version : 1.0 * @description: Checks whole linestring to make sure all adjacent measures are increasing. * Returns 'TRUE' if increasing, 'FALSE' otherwise. * @usage : Function ST_Is_Measure_Increasing( p_geometry in mdsys.sdo_geometry) * Returns varchar2; * @param : p_geometry : MDSYS.SDO_GEOMETRY : A linestring(2002) or multi-linestring (2006) sdo_geometry * @ object describing the line to be split. * @return : is_increasing : varchar2 : Returns 'TRUE' if increasing, 'FALSE' otherwise. * @history : Simon Greener - Jan 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Is_Measure_Increasing(p_geometry IN SDO_GEOMETRY) RETURN VARCHAR2 Deterministic; /** ---------------------------------------------------------------------------------------- * @function : ST_Clip * @precis : A procedure that clips out a segment of a line geometry between two known points * @version : 1.0 * @description: This procedure will split a linestring or multi-linestring sdo_geometry object * between two supplied (known) points. Normally the points should lie on the linestring at * a vertex or between two vertices but the algorithm used will clip a line even if * the points do not lie exactly on the line. Where a point does not lie on the linestring * the algorithm approximates the nearest point on the linestring to the supplied point * and splits it there: the algorithm is ratio based and will not be accurate for geodetic data. * @usage : procedure ST_Clip( p_geometry in mdsys.sdo_geometry, * p_point1 in mdsys.sdo_geometry, * p_point2 in mdsys.sdo_geometry, * p_tolerance in number default 0.005, * p_exception in pls_integer default 0) * @param : p_geometry : MDSYS.SDO_GEOMETRY : A linestring(2002) or multi-linestring (2006) sdo_geometry * @ object describing the line to be split. * @param : p_point1 : MDSYS.SDO_GEOMETRY : A point(2001) sdo_geometry object describing the first split point * @param : p_point2 : MDSYS.SDO_GEOMETRY : A point(2001) sdo_geometry object describing the seconds split point. * @param : p_tolerance : NUMBER : Tolerance value used in mdsys.sdo_geom.sdo_distance function. * @param : p_exception : PLS_INTEGER : If set to 1 then an exception will be thrown if any error is discovered, * @ otherwise NULL values are returned. Useful when procesing large SQL statements. * @return : line_segment: MDSYS.SDO_GEOMETRY : First part of split linestring * @history : Simon Greener - Jan 2011 - Original coding. * @copyright : Simon Greener, 2011, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Clip(p_geometry IN mdsys.sdo_geometry, p_point1 IN mdsys.sdo_geometry, p_point2 IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN pls_integer DEFAULT 0) RETURN mdsys.sdo_geometry Deterministic; . FUNCTION ST_Clip( p_geometry IN mdsys.sdo_geometry, p_start_value IN NUMBER, p_end_value IN NUMBER, P_Value_Type IN Varchar2 DEFAULT 'L', -- or 'M' p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN PLS_INTEGER DEFAULT 0 ) RETURN mdsys.sdo_geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Snap * @precis : Snaps a point to Line * @version : 1.0 * @description: The function snaps a point to the supplied line. * @usage : procedure ST_snap(p_geometry in mdsys.sdo_geometry, * p_point in mdsys.sdo_geometry, * p_tolerance in number default 0.005, * p_exception in pls_integer default 0) * @param : p_geometry : MDSYS.SDO_GEOMETRY : A linestring(2002) or multi-linestring (2006) * sdo_geometry object describing the line to be split. * @param : p_point : MDSYS.SDO_GEOMETRY : A point(2001) sdo_geometry object describing the * point for splitting the linestring. * @param : p_tolerance : NUMBER : Tolerance value used in mdsys.sdo_geom.sdo_distance function. * @param : p_exception : PLS_INTEGER : If set to 1 then an exception will be thrown if any error * is discovered, otherwise NULL values are returned. * Useful when procesing large SQL statements. * @return : snapped_point : MDSYS.SDO_GEOMETRY : Snapped point * @note : Uses Split() with p_snap = 1 * @history : Simon Greener - Jun 2010 * @copyright : Simon Greener, 2010, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Snap( p_geometry IN mdsys.sdo_geometry, p_point IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN pls_integer DEFAULT 0) RETURN mdsys.sdo_geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Locate_Point * @precis : Returns the point (possibly offset) located at a specified measure from the start of a measured linestring. * @version : 1.0 * @param : p_geometry : MDSYS.SDO_GEOMETRY : A linestring(2002) or multi-linestring (2006) * sdo_geometry object describing the line to be split. * @param : p_distance : Number : Distance or Measure at which to locate the point. * @param : p_offset : NUMBER : Distance to measure perpendicularly from the points along geom_segment. * Positive offset values are to the left of p_geometry; * Negative offset values are to the right of p_geometry. * @param : p_tolerance : NUMBER : Tolerance value used in mdsys.sdo_geom.sdo_distance function. * @param : p_distance_type : VARCHAR2 : Interpret p_distance as Measure or a Length * @param : p_tolerance : NUMBER : Tolerance value used in mdsys.sdo_geom.sdo_distance function. * @param : p_exception : PLS_INTEGER : If set to 1 then an exception will be thrown if any error * is discovered, otherwise NULL values are returned. * Useful when procesing large SQL statements. * @return : point : SDO_GEOMETRY : Located (and offset) point at distance or measure. * @history : Simon Greener - Jun 2010 * @copyright : Simon Greener, 2010, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Locate_Point(p_geometry IN mdsys.sdo_geometry, p_distance IN NUMBER DEFAULT NULL, p_offset IN NUMBER DEFAULT NULL, p_distance_type IN VARCHAR2 DEFAULT 'L', -- or 'M' p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN PLS_INTEGER DEFAULT 0) RETURN mdsys.sdo_geometry Deterministic; . FUNCTION ST_Find_Measure(p_geometry IN mdsys.sdo_geometry, p_point IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN PLS_INTEGER DEFAULT 0) RETURN NUMBER deterministic; . FUNCTION ST_Split_Lines(p_geometry IN mdsys.sdo_geometry, P_Splitter IN Mdsys.Sdo_Geometry, P_Tolerance IN NUMBER DEFAULT 0.005, p_exception IN pls_integer DEFAULT 0) RETURN &&defaultSchema..LINEAR.t_GeometrySet pipelined; . FUNCTION ST_getSplitPoints(p_geometry IN mdsys.sdo_geometry, p_splitter IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN pls_integer DEFAULT 0) RETURN &&defaultSchema..LINEAR.t_geometrySet pipelined; . FUNCTION ST_Concat_Lines(p_lines IN &&defaultSchema..LINEAR.t_geometrySet) RETURN mdsys.sdo_geometry deterministic; . FUNCTION ST_Concatenate_Geom_Segments(p_geom_segment_1 IN SDO_GEOMETRY, p_geom_segment_2 IN SDO_GEOMETRY, p_tolerance IN NUMBER DEFAULT 1.0e-8) RETURN mdsys.sdo_geometry deterministic; /** ---------------------------------------------------------------------------------------- * @function : ST_Reset_Measure * @precis : Sets all measures of a measured linesting to null values. * Wipes all existing assigned measures. * @version : 1.0 * @param : p_geometry : sdo_geometry : measured geometry * @return : sdo_geometry : reset measure * @history : Simon Greener - Dec 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Reset_Measure(p_geometry IN mdsys.sdo_geometry) RETURN mdsys.sdo_geometry deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Measure_Range * @precis : Returns the measure range of a measured linestring. * Range is the difference between the first and last measure values. * @version : 1.0 * @param : p_geometry : sdo_geometry : measured geometry * @return : number : measured range * @history : Simon Greener - Dec 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Measure_Range(p_geometry IN SDO_GEOMETRY) RETURN NUMBER deterministic; /** ---------------------------------------------------------------------------------------- * @function : ST_Start_Measure * @precis : Returns the measure of the first vertex in a measured linestring. * @version : 1.0 * @param : p_geometry : sdo_geometry : measured geometry * @return : number : measure value * @history : Simon Greener - Dec 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Start_Measure(p_geometry IN SDO_GEOMETRY) RETURN NUMBER deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_End_Measure * @precis : Returns the measure of the last vertex in a measured linestring. * @version : 1.0 * @param : p_geometry : sdo_geometry : measured geometry * @return : number : measure value * @history : Simon Greener - Dec 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_End_Measure(p_geometry IN SDO_GEOMETRY) RETURN NUMBER deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Measure_To_Percentage * @precis : Returns the percentage (0 to 100) of the measured within the measured range * of a measured linestring. * @version : 1.0 * @param : p_geometry : sdo_geometry : measured geometry * @return : number : measure expressed as a percentage of the measure range. * @history : Simon Greener - Dec 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Percentage_To_Measure(p_geometry IN SDO_GEOMETRY, p_measure IN NUMBER) RETURN NUMBER deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Measure_To_Percentage * @precis : Returns the measure associated associated with a position within a measured * linestring expressed as a percentage (0 to 100). * @version : 1.0 * @param : p_geometry : sdo_geometry : measured geometry * @return : number : measure associated with the supplied percentage * @history : Simon Greener - Dec 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Percentage_To_Measure(p_geometry IN SDO_GEOMETRY, p_percentage IN NUMBER) RETURN NUMBER deterministic; . /** * ST_AddMeasure * Return a derived geometry with measure elements linearly interpolated between the start and end points. * If the geometry has no measure dimension, one is added. If the geometry has a measure dimension, it is * over-written with new values. Only LINESTRINGS and MULTILINESTRINGS are supported. * * geometry ST_AddMeasure(geometry geom_mline, float measure_start, float measure_end); */ FUNCTION ST_AddMeasure(p_geometry IN mdsys.sdo_geometry, p_start_measure IN NUMBER, p_end_measure IN NUMBER, p_tolerance IN NUMBER DEFAULT 0.005) RETURN Mdsys.Sdo_Geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Reverse_Measure * @precis : Reverses the measure values of measured linestring * @version : 1.0 * @description: The function reverses the measure values in supplied sdo_geometry's sdo_ordinate_array. * @usage : select ST_Reverse_Measure(p_geometry) from dual; * @param : p_geometry : MDSYS.SDO_GEOMETRY : sdo_geometry whose ordinates will be reversed * @return : modified geometry : MDSYS.SDO_GEOMETRY : SDO_Geometry with reversed measure * @history : Simon Greener - Feb 2012 2010 * @copyright : Simon Greener, 2010, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Reverse_Measure(p_geometry IN mdsys.sdo_geometry) RETURN mdsys.sdo_geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Scale_Geom_Segment * @precis : Returns the geometry object resulting from a measure scaling operation on a geometric segment. * @version : 1.0 * @history : Simon Greener - Jul 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Scale_Geom_Segment( p_geometry IN mdsys.sdo_geometry, p_start_measure IN NUMBER, p_end_measure IN NUMBER, p_shift_measure IN NUMBER DEFAULT 0.0 ) RETURN mdsys.sdo_geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_isMeasured * @precis : A function that tests whether an sdo_geometry contains LRS measures * @version : 1.0 * @param : p_gtype : number : sdo_geometry sdo_gtype * @return : pls_integer : 1 is true if geometry has an LRS measure * @history : Simon Greener - Dec 2008 - Original coding. * @copyright : Simon Greener, 2008, 2009, 2010, 2011, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_isMeasured( p_gtype IN NUMBER ) RETURN pls_integer deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_getMeasureDimension * @precis : A function returns the dimension holding the LRS measure * @version : 1.0 * @param : p_gtype : number : sdo_geometry sdo_gtype * @return : pls_integer : 0 if geometry has no measure otherwise the dimension holding the * measure (eg in 3302, the measure is 3) * @history : Simon Greener - Jul 2102 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_getMeasureDimension( p_gtype IN NUMBER ) RETURN pls_integer deterministic; /** ---------------------- Point Extractors ------------------------------ **/ . /** ---------------------------------------------------------------------------------------- * @function : ST_Set_Pt_Measure * @precis : Sets measure of vertex nearest to the supplied point * @version : 1.0 * @param : p_geometry : sdo_geometry : The actual measured geometry * @param : p_point : sdo_geometry : A point geometry coded in sdo_point_type * @return : measure linestring : sdo_geometry * @history : Simon Greener - Jul 2012 - Original coding. * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Set_Pt_Measure(p_geometry IN SDO_GEOMETRY, p_point IN SDO_GEOMETRY, p_measure IN NUMBER, p_tolerance IN NUMBER DEFAULT 0.05) RETURN sdo_geometry deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Get_Point * @precis : Returns the vertex associated with the supplied point number * @version : 1.0 * @param : p_geometry : sdo_geometry : The actual geometry * @param : p_point_array : number : 1 .. sdo_util.getNumVertices(), with -1 meaning last vertex * @return : point geometry : sdo_geometry * @history : Simon Greener - Jul 2010 - Original coding. * @copyright : Simon Greener, 2010-2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Get_Point(p_geometry IN MDSYS.SDO_GEOMETRY, p_point_number IN NUMBER DEFAULT 1 ) RETURN MDSYS.sdo_geometry deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Start_Point * @precis : Returns the first vertex in the supplied geometry if exists * @version : 1.0 * @param : p_geometry : sdo_geometry : The actual geometry * @return : point geometry : sdo_geometry * @history : Simon Greener - Jul 2010 - Original coding. * @copyright : Simon Greener, 2010-2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Start_Point( p_geometry IN mdsys.sdo_geometry ) RETURN mdsys.sdo_geometry deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_End_Point * @precis : Returns the last vertex in the supplied geometry if exists * @version : 1.0 * @param : p_geometry : sdo_geometry : The actual geometry * @return : point geometry : sdo_geometry * @history : Simon Greener - Jul 2010 - Original coding. * @copyright : Simon Greener, 2010-2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_End_Point ( p_geometry IN mdsys.sdo_geometry ) RETURN mdsys.sdo_geometry deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Point_Text * @precis : Returns the vertex associated with the supplied point number as formatted text * @version : 1.0 * @param : p_geometry : sdo_geometry : The actual geometry * @param : p_point_array : number : 1 .. sdo_util.getNumVertices(), with -1 meaning last vertex * @return : formatted_string : varchar2 * @history : Simon Greener - Jul 2010 - Original coding. * @copyright : Simon Greener, 2010-2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Point_Text( p_geometry IN mdsys.sdo_geometry, p_point_number IN NUMBER DEFAULT 1 ) RETURN varchar2 deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Start_point_text * @precis : Returns the first vertex in the supplied geometry as formatted text * @version : 1.0 * @param : p_geometry : sdo_geometry : The actual geometry * @param : p_point_array : number : 1 .. sdo_util.getNumVertices(), with -1 meaning last vertex * @return : formatted_string : varchar2 * @history : Simon Greener - Jul 2010 - Original coding. * @copyright : Simon Greener, 2010-2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Start_point_text( p_geometry IN mdsys.sdo_geometry ) RETURN varchar2 deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_End_point_text * @precis : Returns the last vertex in the supplied geometry as formatted text * @version : 1.0 * @param : p_geometry : sdo_geometry : The actual geometry * @param : p_point_array : number : 1 .. sdo_util.getNumVertices(), with -1 meaning last vertex * @return : formatted_string : varchar2 * @history : Simon Greener - Jul 2010 - Original coding. * @copyright : Simon Greener, 2010-2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_End_point_text( p_geometry IN mdsys.sdo_geometry ) RETURN varchar2 deterministic; . /** --------------------------------------------------------------------------------- **/ /** ------------------- PostGIS/JASPA Linear Referencing wrappers ------------------- **/ /** --------------------------------------------------------------------------------- **/ . /** * ST_Line_Locate_Point * double ST_Line_Locate_Point(bytea Line, bytea Point) * Computes the fraction of a Line from the closest point on the line to the given point. * The point does not necessarily have to lie precisely on the line. * Both geometries must have the same SRID and dimensions. * Wrapper (based on PostGIS) over * Function Find_Measure(p_geometry IN mdsys.sdo_geometry, * p_point IN mdsys.sdo_geometry, * p_tolerance IN NUMBER DEFAULT 0.005, * p_exception IN PLS_INTEGER DEFAULT 0) * Return Number Deterministic; **/ FUNCTION ST_Line_Locate_Point(p_geometry IN Mdsys.Sdo_Geometry, P_Point IN Mdsys.Sdo_Geometry, P_Tolerance IN NUMBER DEFAULT 0.005, p_exception IN Pls_Integer DEFAULT 0) RETURN NUMBER Deterministic; . /** * ST_Locate_ALong_Measure * Extracts Points from a Geometry object that have the specified m coordinate value. * Wrapper (based on PostGIS) over Function ST_Locate_Along_Measure(p_geometry IN mdsys.sdo_geometry, p_m IN NUMBER, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN PLS_INTEGER DEFAULT 0) Return mdsys.sdo_geometry Deterministic; */ FUNCTION ST_Locate_Along_Measure(P_Geometry IN Mdsys.Sdo_Geometry, p_m IN NUMBER, P_Tolerance IN NUMBER DEFAULT 0.005, p_exception IN Pls_Integer DEFAULT 0 ) RETURN Mdsys.Sdo_Geometry Deterministic; . /** * ST_Locate_Between_Measures * geometry ST_Locate_Between_Measures(bytea Geometry, double start_M, double end_M) * Returns a derived geometry whose measures are in the specified M range. * Wrapper (based on PostGIS) over * Function Clip( p_geometry IN mdsys.sdo_geometry, * p_start_value IN NUMBER, * p_end_value IN NUMBER, * p_tolerance IN NUMBER DEFAULT 0.005, * p_exception IN PLS_INTEGER DEFAULT 0 ) * Return Mdsys.Sdo_Geometry Deterministic; **/ FUNCTION ST_Locate_Between_Measures(p_Geometry IN Mdsys.Sdo_Geometry, P_Start_M IN NUMBER, p_End_M IN NUMBER, P_Tolerance IN NUMBER DEFAULT 0.005, P_Exception IN Pls_Integer DEFAULT 0 ) RETURN Mdsys.Sdo_Geometry Deterministic; . /** * ST_Line_SubString * Line ST_Line_Substring(Bytea Geometry, Double Startfraction, Double Endfraction) * Returns A Linestring Being A Portion Of The Input One. It Will Start And End At * The Given Fractions (Eg 0.2 / 20% To 0.8 / 80%) Of The Total 2D Length. **/ FUNCTION ST_Line_Substring(P_Geometry IN Mdsys.Sdo_Geometry, P_Startfraction IN NUMBER, P_Endfraction IN NUMBER, P_Tolerance IN NUMBER DEFAULT 0.005, P_Exception IN Pls_Integer DEFAULT 0 ) RETURN Mdsys.Sdo_Geometry Deterministic; . /** * ST_Locate_Along_Elevation * geometry ST_Locate_Along_Elevation(bytea Geometry, double Z) * Extracts Points from a Geometry object that have the specified z coordinate value. * Wrapper over: Locate_Point() with p_distance_type = Z */ FUNCTION ST_Locate_Along_Elevation(P_Geometry IN Mdsys.Sdo_Geometry, P_Z IN NUMBER, P_Tolerance IN NUMBER DEFAULT 0.005, p_exception IN Pls_Integer DEFAULT 0) RETURN Mdsys.Sdo_Geometry Deterministic; . /** * ST_Locate_Between_Elevations * Geometry ST_Locate_Between_Elevations(Bytea Geometry, Double Start_Z, Double End_Z) * Returns A Derived Geometry Whose Elevation Are In The Specified Z Range. */ FUNCTION ST_Locate_Between_Elevations(P_Geometry IN Mdsys.Sdo_Geometry, p_start_value IN NUMBER, P_End_Value IN NUMBER, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN PLS_INTEGER DEFAULT 0 ) RETURN Mdsys.Sdo_Geometry Deterministic; . /** * ST_Line_Interpolate_Point * point ST_Line_Interpolate_Point(bytea Geometry, double fraction); * Returns the Coordinates for the point on the line at the given fraction. * This fraction (ie percentage 0.9 = 80%), is applied to the line''s total length. **/ FUNCTION ST_Line_Interpolate_Point(P_Geometry IN Mdsys.Sdo_Geometry, p_Fraction IN NUMBER, P_Tolerance IN NUMBER DEFAULT 0.005, p_exception IN Pls_Integer DEFAULT 0) RETURN Mdsys.Sdo_Geometry Deterministic; . /** * ST_Project_Point * geometry ST_Project_Point(bytea Line, bytea Point) * Finds the closest point from a Line to a given point. * NOTE: ST_Project_Point (Line, Point) is a shortening of * ST_Line_Interpolate_Point(line,ST_Line_Locate_Point(line,point))) * Wrapper over: * Function Snap( p_geometry in mdsys.sdo_geometry, * p_point in mdsys.sdo_geometry, * p_tolerance in number default 0.005, * p_exception in pls_integer default 0) * Return mdsys.sdo_geometry Deterministic; **/ FUNCTION ST_Project_Point(P_Line IN Mdsys.Sdo_Geometry, P_Point IN Mdsys.Sdo_Geometry, P_Tolerance IN NUMBER DEFAULT 0.005, p_exception IN Pls_Integer DEFAULT 0) RETURN Mdsys.Sdo_Geometry Deterministic; . /** --------------------------------------------------------------------------------- **/ /** ---------------------------- Some SDO_LRS Wrappers ------------------------------ **/ /** --------------------------------------------------------------------------------- **/ . /** * ST_Project_PT * Wrapper for SDO_LRS.PROJECT_PT * Returns the projection point of a specified point. The projection point is on the geometric segment. * Wrapper over: * Function Snap( p_geometry in mdsys.sdo_geometry, * p_point in mdsys.sdo_geometry, * p_tolerance in number default 0.005, * p_exception in pls_integer default 0) * Return mdsys.sdo_geometry Deterministic; **/ FUNCTION ST_Project_PT(geom_segment IN SDO_GEOMETRY, point IN SDO_GEOMETRY, tolerance IN NUMBER DEFAULT 1.0e-8 /* NO OFFSET AS IS FUNCTION */ ) RETURN mdsys.sdo_geometry deterministic; . /* Wrapper */ FUNCTION ST_Define_Geom_Segment(geom_segment IN SDO_GEOMETRY, start_measure IN NUMBER, end_measure IN NUMBER) RETURN sdo_geometry Deterministic; /* * @function ST_Convert_To_Lrs_Geom * @precis Wrapper to look like SDO_LRS.CONVERT_TO_LRS_GEOM * @precis Converts a 2/3D geometry to measured geometry. * @version 1.1 * @usage v_m_geom := convert_to_lrs_geom(MDSYS.SDO_Geometry(2002,....),0,50) * @history Simon Greener, Jun 2011 Original Coding. * @history Simon Greener, Feb 2012 Re-wrote. */ FUNCTION ST_Convert_To_Lrs_Geom( p_geometry IN mdsys.sdo_geometry, p_start_measure IN NUMBER DEFAULT NULL, p_end_measure IN NUMBER DEFAULT NULL, p_tolerance IN NUMBER DEFAULT 0.005 ) RETURN mdsys.sdo_geometry deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Clip_Geom_Segment * @precis : Wrapper to look like SDO_LRS.CLIP_GEOM_SEGMENT * @version : 1.0 * @history : Simon Greener - Jun 2011 - Original coding. * @copyright : Simon Greener, 2011, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Clip_Geom_Segment(p_lrs_line IN mdsys.sdo_geometry, p_current_start IN NUMBER, p_window_start IN NUMBER, p_tolerance IN NUMBER DEFAULT 0.005, p_exception IN PLS_INTEGER DEFAULT 0 ) RETURN mdsys.sdo_geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Offset_Geom_Segment * @precis : Returns a geometric segment at a specified measure range and offset. * @version : 1.0 * @description: The function clips a linestring based on the measure range then offsets the result. * @usage : select ST_Offset_Geom_Segment(p_geometry) from dual; * @param : p_geometry : MDSYS.SDO_GEOMETRY : sdo_geometry whose ordinates will be reversed * @param : p_start_measure : NUMBER : Start measure of segment at which to start the offset operation. * @param : p_end_measure : NUMBER : End measure of geom_segment at which to start the offset operation. * @param : p_offset : NUMBER : Distance to measure perpendicularly from the points along geom_segment. * Positive offset values are to the left of geom_segment; * Negative offset values are to the right of geom_segment. * @param : p_tolerance : NUMBER : Tolerance value used in mdsys.sdo_geom.sdo_distance function. * Default 0.00000001. * @param : p_unit : VARCHAR2 : Unit of measurement specification: a quoted string eg 'unit=km arc_tolerance=0.05' * @return : modified geometry : MDSYS.SDO_GEOMETRY : SDO_Geometry with reversed ordinates * @history : Simon Greener - July 2012 * @copyright : Simon Greener, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Offset_Geom_Segment(p_geometry IN SDO_GEOMETRY, p_start_measure IN NUMBER, p_end_measure IN NUMBER, p_offset IN NUMBER, p_tolerance IN NUMBER DEFAULT 1.0e-8, p_unit IN VARCHAR2 DEFAULT NULL) RETURN SDO_Geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_geom_segment_length * @precis : Wrapper for sdo_length as is function in SDO_LRS.GEOM_SEGMENT_LENGTH * @version : 1.0 * @history : Simon Greener - Jun 2011 - Original coding. * @copyright : Simon Greener, 2011, 2012 * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_geom_segment_length(p_geometry IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.005 ) RETURN NUMBER Deterministic; /* ==================================================================== */ /* ======================== Utility Functions ========================= */ /* ==================================================================== */ /* * @function ST_To2D * @precis Converts a geometry to a 2D geometry * @version 2.0 * @usage v_2D_geom := LINEAR.ST_To2D(MDSYS.SDO_Geometry(3001,....) * @history Albert Godfrind, July 2006, Original Coding * @history Bryan Hall, July 2006, Modified to handle points * @history Simon Greener, July 2006, Integrated into geom with GF. * @history Simon Greener, Aug 2009, Removed GF; Modified Byan Hall''s version to handle compound elements. * @License : Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ */ FUNCTION ST_To2D(p_geom IN MDSYS.SDO_Geometry ) RETURN MDSYS.SDO_Geometry deterministic; . /* * @function ST_To3D * @precis Converts a 2D or 4D geometry to a 3D geometry * @version 1.0 * @usage v_3D_geom := LINEAR.ST_To3D(MDSYS.SDO_Geometry(2001,....),50) * @history Simon Greener, May 2007 Original coding * @history Simon Greener, Aug 2009 Added support for interpolating Z values * @copyright Simon Greener, 2007 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ */ FUNCTION ST_To3D(p_geom IN MDSYS.SDO_Geometry, p_start_z IN NUMBER DEFAULT NULL, p_end_z IN NUMBER DEFAULT NULL, p_tolerance IN NUMBER DEFAULT 0.005) RETURN MDSYS.SDO_Geometry deterministic; . /* * @function ST_DownTo3D * @precis Converts a 4D geometry to a 3D geometry * @version 1.0 * @usage v_3D_geom := LINEAR.ST_DownTo3D(MDSYS.SDO_Geometry(4001,....),50) * @history Simon Greener, May 2010 Original coding * @copyright Simon Greener, 2010 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ */ FUNCTION ST_DownTo3D(p_geom IN MDSYS.SDO_Geometry, p_z_ord IN INTEGER ) RETURN MDSYS.SDO_GEOMETRY deterministic; . /* * @Function : ST_Fix3DZ * @Precis : Checks the Z ordinate in the SDO_GEOMETRY and if NULL changes to p_default_z value * @Note : Needed as MapServer/ArcSDE appear to not handle 3003/3007 polygons with NULL Z values * in the sdo_ordinate_array * @History : Simon Greener - JUNE 4th 2007 - Original Coding * @copyright : Simon Greener, 2007 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ */ FUNCTION ST_Fix3DZ( p_3D_geom IN MDSYS.SDO_Geometry, p_default_z IN NUMBER DEFAULT -9999 ) RETURN MDSYS.SDO_Geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Reverse_Geometry * @precis : Reverses ordinates in supplied sdo_geometry's sdo_ordinate_array. * @version : 1.0 * @description: The function reverses ordinates in supplied sdo_geometry's sdo_ordinate_array. * @usage : select ST_Reverse_Geometry(p_geometry) from dual; * @param : p_geometry : MDSYS.SDO_GEOMETRY : sdo_geometry whose ordinates will be reversed * @return : modified geometry : MDSYS.SDO_GEOMETRY : SDO_Geometry with reversed ordinates * @history : Simon Greener - Feb 2012 2010 * @copyright : Simon Greener, 2010 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Reverse_Geometry(p_geometry IN mdsys.sdo_geometry) RETURN mdsys.sdo_geometry Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_Parallel * @precis : Function that moves the supplied linestring left/right a fixed amount. * Bends in the linestring, when moved, can remain vertex-connected or be converted to curves. * @version : 1.0 * @usage : FUNCTION ST_Parallel(p_geometry in mdsys.sdo_geometry, * p_distance in number, * p_tolerance in number, * p_curved in number := 0) * RETURN mdsys.sdo_geometry DETERMINISTIC; * eg select ST_Parallel(mdsys.sdo_geometry(2002,null,null,sdo_elem_info_array(1,2,1),sdo_ordinate_array(1,1,1,10)),10,0.05) from dual; * @param : p_geometry : mdsys.sdo_geometry : Original linestring/multilinestring * @param : p_distance : Number : Distance to move parallel -vs = left; +ve = right * @param : p_tolerance : Number : Standard Oracle diminfo tolerance. * @param : p_curved : Integer (but really boolean) : Boolean flag indicating whether to stroke * bends in line (1=stroke;0=leave alone) * @return : mdsys.sdo_geometry : input geometry moved parallel by p_distance units * @history : Simon Greener - Devember 2008 - Original coding. * @copyright : Simon Greener, 2008 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Parallel(p_geometry IN mdsys.sdo_geometry, p_distance IN NUMBER, p_tolerance IN NUMBER, p_curved IN NUMBER := 0) RETURN mdsys.sdo_geometry DETERMINISTIC; . /** ---------------------------------------------------------------------------------------- * @function : ST_RoundOrdinates * @precis : Rounds ordinate values (sdo_ordinate_array) of an sdo_geometry * @version : 1.0 * @description: The function rounds ordinate values (sdo_ordinate_array) of an sdo_geometry * @usage : select ST_RoundOrdinates(p_geometry) from dual * @param : p_geometry : MDSYS.SDO_GEOMETRY : sdo_geometry whose ordinates will be rounded * @param : P_X_Round_Factor : Number : X ordinate tolerance * @return : p_y_round_factor : Number : Y ordinate tolerance * @return : P_Z_Round_Factor : Number : Z ordinate tolerance * @return : p_m_round_factor : Number : M ordinate tolerance * @return : modified geometry : MDSYS.SDO_GEOMETRY : SDO_Geometry with rounded ordinates * @history : Simon Greener - Jun 2010 * @copyright : Simon Greener, 2010 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_RoundOrdinates(P_Geometry IN Mdsys.Sdo_Geometry, P_X_Round_Factor IN NUMBER, p_y_round_factor IN NUMBER DEFAULT NULL, P_Z_Round_Factor IN NUMBER DEFAULT NULL, p_m_round_factor IN NUMBER DEFAULT NULL) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC; . /** ---------------------------------------------------------------------------------------- * @function : ST_hasElementCircularArcs * @precis : A function that tests whether an sdo_geometry element contains circular arcs * @version : 1.0 * @history : Simon Greener - Aug 2009 - Original coding. * @copyright : Simon Greener, 2009 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_hasElementCircularArcs(p_elem_type IN NUMBER) RETURN BOOLEAN deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_hasRectangles * @precis : A function that tests whether an sdo_geometry contains rectangles * @version : 1.0 * @param : p_elem_info : mdsys.sdo_elem_info_array : sdo_geometry's sdo_elem_info_array * @return : pls_integer : 1 is true ie has optimized rectangle elements, 0 otherwise * @history : Simon Greener - Jun 2011 - Original coding. * @copyright : Simon Greener, 2011 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_hasRectangles( p_elem_info IN mdsys.sdo_elem_info_array ) RETURN Pls_Integer deterministic; /** ---------------------------------------------------------------------------------------- * @function : ST_Vectorize * @precis : Places a geometry''s coordinates into a pipelined vector data structure. * @version : 3.0 * @description: Loads the coordinates of a linestring, polygon geometry into a * pipelined vector data structure for easy manipulation by other functions * such as geom.SDO_Centroid. * @usage : Function ST_Vectorize( p_geometry IN MDSYS.SDO_GEOMETRY, * p_dimarray IN MDSYS.SDO_DIM_ARRAY ) * Return RETURN t_VectorSet PIPELINED * eg select * * from myshapetable a, * table(&&defaultSchema..linear.ST_Vectorize(a.shape)); * @param : p_geometry : MDSYS.SDO_GEOMETRY : A geographic shape. * @return : geomVector : t_VectorSet : The vector pipelined. * @requires : Global data types T_Vertex, T_Vector and t_VectorSet * @requires : GF package. * @history : Simon Greener - July 2006 - Original coding from GetVector * @history : Simon Greener - July 2008 - Re-write to be standalone of other packages eg GF * @history : Simon Greener - October 2008 - Removed 2D limits * @copyright : Simon Greener, 2006 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Vectorize(p_geometry IN mdsys.sdo_geometry, p_exception IN PLS_INTEGER DEFAULT 0) RETURN &&defaultSchema..LINEAR.t_VectorSet pipelined; /*** * @function : ST_Vectorize * @precis : Places a geometry's coordinates into a pipelined vector data structure using ST_Point (ie > 2D). * @version : 2.0 * @param : p_geometry : MDSYS.SDO_GEOMETRY : A geographic shape. * @param : p_arc2chord : number : The arc2chord distance used in converting circular arcs and circles. * Expressed in dataset units eg decimal degrees if 8311. See Convert_Distance * for method of converting distance in meters to dataset units. * @history : Simon Greener - Jan 2007 - ST_Point support, integrated into this package. * @history : Simon Greener - Apr 2008 - Rebuilt to be a wrapper over GetVector. * @copyright : Simon Greener, 2007 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Vectorize(p_geometry IN mdsys.sdo_geometry, p_arc2chord IN NUMBER, p_exception IN PLS_INTEGER DEFAULT 0 ) RETURN &&defaultSchema..LINEAR.t_VectorSet pipelined; . /** ---------------------------------------------------------------------------------------- * @function : ST_GetNumRings * @precis : Returns Number of Rings in a polygon/mutlipolygon. * @version : 1.0 * @usage : Function ST_GetNumRings ( p_geometry IN MDSYS.SDO_GEOMETRY, * p_ring_type IN INTEGER ) * Return Number Deterministic; * @example : SELECT ST_GetNumRings(SDO_GEOMETRY(2007, -- two-dimensional multi-part polygon with hole * NULL, * NULL, * SDO_ELEM_INFO_ARRAY(1,1005,2, 1,2,1, 5,2,2, * 11,2005,2, 11,2,1, 15,2,2, * 21,1005,2, 21,2,1, 25,2,2), * SDO_ORDINATE_ARRAY( 6,10, 10,1, 14,10, 10,14, 6,10, * 13,10, 10,2, 7,10, 10,13, 13,10, * 106,110, 110,101, 114,110, 110,114,106,110) * ) * ) * as RingCount * FROM DUAL; * @param : p_geometry : MDSYS.SDO_GEOMETRY : A shape. * @param : p_ring_type : integer : Number of outer and inner rings. * @ Values LINEAR.c_rings_all, LINEAR.c_rings_outer, LINEAR.c_rings_inner * @return : numberRings : Number * @history : Simon Greener - Dec 2008 - Original coding. * @copyright : Simon Greener, 2008 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_GetNumRings( p_geometry IN mdsys.sdo_geometry, p_ring_type IN INTEGER DEFAULT &&defaultSchema..LINEAR.c_rings_all ) RETURN NUMBER Deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_hasCircularArcs * @precis : A function that tests whether an sdo_geometry contains circular arcs * @version : 1.0 * @history : Simon Greener - Dec 2008 - Original coding. * @copyright : Simon Greener, 2008 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_hasCircularArcs(p_elem_info IN mdsys.sdo_elem_info_array) RETURN BOOLEAN deterministic; . /** Wrappers */ FUNCTION ST_isCompound(p_elem_info IN mdsys.sdo_elem_info_array) RETURN INTEGER deterministic; . FUNCTION ST_hasArc(p_elem_info IN mdsys.sdo_elem_info_array) RETURN INTEGER deterministic; . /** ---------------------------------------------------------------------------------------- * @function : ST_FindLineIntersection * @precis : Find the point where two vectors intersect. * @version : 1.0 * @usage : PROCEDURE ST_FindLineIntersection(x11 in number, y11 in number, * x12 in Single, y12 in Single, * x21 in Single, y21 in Single, * x22 in Single, y22 in Single, * inter_x OUT Single, inter_y OUT Single, * inter_x1 OUT Single, inter_y1 OUT Single, * inter_x2 OUT Single, inter_y2 OUT Single ); * @param : x11 : NUMBER : X Ordinate of the start point for the first vector * @param : y11 : NUMBER : Y Ordinate of the start point for the first vector * @param : x12 : NUMBER : X Ordinate of the end point for the first vector * @param : y12 : NUMBER : Y Ordinate of the end point for the first vector * @param : x21 : NUMBER : X Ordinate of the start point for the second vector * @param : y21 : NUMBER : Y Ordinate of the start point for the second vector * @param : x22 : NUMBER : X Ordinate of the end point for the second vector * @param : y22 : NUMBER : Y Ordinate of the end point for the second vector * @description: (inter_x, inter_y) is the point where the lines * defined by the segments intersect. * (inter_x1, inter_y1) is the point on segment 1 that * is closest to segment 2. * (inter_x2, inter_y2) is the point on segment 2 that * is closest to segment 1. . * If the lines are parallel, all returned coordinates are 1E+38. * ------- * Method: * Treat the lines as parametric where line 1 is: * X = x11 + dx1 * t1 * Y = y11 + dy1 * t1 * and line 2 is: * X = x21 + dx2 * t2 * Y = y21 + dy2 * t2 * Setting these equal gives: * x11 + dx1 * t1 = x21 + dx2 * t2 * y11 + dy1 * t1 = y21 + dy2 * t2 * Rearranging: * x11 - x21 + dx1 * t1 = dx2 * t2 * y11 - y21 + dy1 * t1 = dy2 * t2 * (x11 - x21 + dx1 * t1) * dy2 = dx2 * t2 * dy2 * (y11 - y21 + dy1 * t1) * (-dx2) = dy2 * t2 * (-dx2) * Adding the equations gives: * (x11 - x21) * dy2 + ( dx1 * dy2) * t1 + * (y21 - y11) * dx2 + (-dy1 * dx2) * t1 = 0 * Solving for t1 gives: * t1 * (dy1 * dx2 - dx1 * dy2) = * (x11 - x21) * dy2 + (y21 - y11) * dx2 * t1 = ((x11 - x21) * dy2 + (y21 - y11) * dx2) / * (dy1 * dx2 - dx1 * dy2) * Now solve for t2. * ---------- * @Note : If 0 <= t1 <= 1, then the point lies on segment 1. * : If 0 <= t2 <= 1, then the point lies on segment 1. * : If dy1 * dx2 - dx1 * dy2 = 0 then the lines are parallel. * : If the point of intersection is not on both * : segments, then this is almost certainly not the * : point where the two segments are closest. * @note : Does not throw exceptions * @note : Assumes planar projection eg UTM. * @history : Simon Greener - Mar 2006 - Original coding. */ PROCEDURE ST_FindLineIntersection( x11 IN NUMBER, y11 IN NUMBER, x12 IN NUMBER, y12 IN NUMBER, x21 IN NUMBER, y21 IN NUMBER, x22 IN NUMBER, y22 IN NUMBER, inter_x OUT nocopy NUMBER, inter_y OUT nocopy NUMBER, inter_x1 OUT nocopy NUMBER, inter_y1 OUT nocopy NUMBER, inter_x2 OUT nocopy NUMBER, inter_y2 OUT nocopy NUMBER ); . /** ---------------------------------------------------------------------------------------- * @function : Generate_Series * @precis : Function that generates a series of numbers mimicking PostGIS's function with * the same name * @version : 1.0 * @usage : Function generate_series(p_start pls_integer, * p_end pls_integer, * p_step pls_integer ) * Return &&defaultSchema..geom.t_integers Pipelined; * eg SELECT s.* FROM TABLE(generate_series(1,1000,10)) s; * @param : p_start : Integer : Starting value * @param : p_end : Integer : Ending value. * @return : p_step : Integer : The step value of the increment between start and end * @history : Simon Greener - June 2008 - Original coding. * @copyright : Simon Greener, 2007 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION Generate_Series(p_start pls_integer, p_end pls_integer, p_step pls_integer ) RETURN &&defaultSchema..LINEAR.t_integers Pipelined; . /** ---------------------------------------------------------------------------------------- * @function : sdo_length * @precis : SDO_GEOM.SDO_LENGTH is not licensed for LOCATOR users on certain databases. * This function uses the licensed SDO_GEOM.SDO_DISTANCE function to compute length * of lines, multilines, polygon and multipolygon boundaries. * @version : 1.0 * @description: This function is a SQL based function that uses sdo_distance which is a Locator function. * @usage : Function SDO_Length ( p_geometry IN MDSYS.SDO_GEOMETRY, * p_dimarray IN MDSYS.SDO_DIM_ARRAY * p_units IN VarChar2 ) * Return Number Deterministic; * eg fixedShape := &&defaultSchema..LINEAR.sdo_length(shape,diminfo); * @param : p_geometry : MDSYS.SDO_GEOMETRY : A valid sdo_geometry. * @param : p_tolerance : MDSYS.SDO_DIM_ARRAY : The dimarray describing the shape. * @param : p_unit : varchar2 : Unit of measure for geometries with SRIDs * @return : length : Number : Length of linestring or boundary of a polygon in required unit of measure * @note : Supplied p_unit should exist in mdsys.SDO_UNITS_OF_MEASURE * @history : Simon Greener - Jun 2011 - Original coding. * @copyright : Simon Greener, 2011 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION sdo_length(p_geometry IN mdsys.sdo_geometry, p_tolerance IN NUMBER DEFAULT 0.05, p_unit IN varchar2 DEFAULT 'Meter' ) RETURN NUMBER deterministic; . /** ---------------------------------------------------------------------------------------- * @function : SDO_LENGTH * @precis : Overload of SDO_Length Function * @version : 1.0 * @usage : Function SDO_Length ( p_geometry IN MDSYS.SDO_GEOMETRY, * p_tolerance IN Number * p_units IN VarChar2 ) * Return Number Deterministic; * eg fixedShape := &&defaultSchema..LINEAR.sdo_length(shape,0.05); * @param : p_geometry : MDSYS.SDO_GEOMETRY : A valid sdo_geometry. * @param : p_dimarray : MDSYS.SDO_DIM_ARRAY : The dimarray describing the shape. * @param : p_unit : varchar2 : Unit of measure for geometries with SRIDs * @return : length : NUMBER : Length of linestring or boundary of a polygon in required unit of measure * @note : Supplied p_unit should exist in mdsys.SDO_UNITS_OF_MEASURE * @history : Simon Greener - Jun 2011 - Original coding. * @copyright : Simon Greener, 201 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION sdo_length(p_geometry IN mdsys.sdo_geometry, p_diminfo IN mdsys.sdo_dim_array, p_unit IN varchar2 DEFAULT 'Meter' ) RETURN NUMBER deterministic; . /**---------------------------------------------------------------------------------------------------- * @function : Tokenizer * @precis : Splits any string into its tokens. * @description : Supplied a string and a list of separators this function * returns resultant tokens as a pipelined collection. * @example : SELECT t.column_value * FROM TABLE(tokenizer('The rain in spain, stays mainly on the plain.!',' ,.!') ) t; * @param : p_string. The string to be Tokenized. * @param : p_separators. The characters that are used to split the string. * @requires : t_Tokens type to be declared. * @history : Pawel Barut, http://pbarut.blogspot.com/2007/03/yet-another-tokenizer-in-oracle.html * @history : Simon Greener - July 2006 - Original coding (extended SQL sourced from a blog on the internet) * @copyright : Simon Greener, 2006 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION Tokenizer(p_string IN VarChar2, p_separators IN VarChar2 DEFAULT ' ') RETURN &&defaultSchema..T_Tokens Pipelined; . /**---------------------------------------------------------------------------------------------------- * @function : TokenAggregator * @precis : A string aggregator. * @description : Takes a set of strings an aggregates/appends them using supplied separator * @example : SELECT TokenAggregator(CAST(COLLECT(to_char(l.lineid)) AS t_Tokens)) AS lineids * FROM test_lines_large_set l; * @param : p_tokenSet : The strings to be aggregated. * @param : p_separator : The character that is placed between each token string. * @requires : t_Tokens type to be declared. * @history : Simon Greener - June 2011 - Original coding * @copyright : Simon Greener, 2011 - 2012 * @License Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION TokenAggregator(p_tokenSet IN &&defaultSchema..t_Tokens, p_delimiter IN VarChar2 DEFAULT ',') RETURN VarChar2 Deterministic; . END LINEAR; / SHOW errors
Some examples of how to use the package follow:
WITH lrs_routes AS ( SELECT SDO_GEOMETRY(3302,NULL,NULL, SDO_ELEM_INFO_ARRAY(1,2,1), SDO_ORDINATE_ARRAY( 2.0,2.0,0.0, 2.0,4.0,3.218, 8.0,4.0,12.872, 12.0,4.0,19.308, 12.0,10.0,28.962, 8.0,10.0,35.398, 5.0,14.0,43.443)) AS geometry FROM DUAL ) SELECT 'Original Measured geometry' AS text, a.geometry AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR.ST_isMeasured(' || a.geometry.sdo_gtype || ')=' || LINEAR.ST_isMeasured(a.geometry.sdo_gtype) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR.ST_getMeasureDimension(' || a.geometry.sdo_gtype || ')=' || LINEAR.ST_getMeasureDimension(a.geometry.sdo_gtype) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Measure_Range = ' || round(LINEAR.ST_Measure_Range(a.geometry),3) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Start_Measure = ' || round(LINEAR.ST_Start_Measure(a.geometry),3) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_End_Measure = ' || round(LINEAR.ST_End_Measure(a.geometry),3) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Is_Measure_Increasing = ' || LINEAR.ST_Is_Measure_Increasing(a.geometry) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Is_Measure_Decreasing = ' || LINEAR.ST_Is_Measure_Decreasing(a.geometry) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Measure_To_Percentage 18/43.443 = ' || round(LINEAR.ST_Measure_To_Percentage(a.geometry,18),2) AS text, a.geometry AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Percentage_To_Measure 41.43% = ' || round(LINEAR.ST_Percentage_To_Measure(a.geometry,41.43),3) AS text, NULL AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR.ST_Reverse_Measure' AS text, LINEAR.ST_Reverse_Measure(a.geometry) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR.ST_Set_Pt_Measure Sets 8,10 m from 22 to 20' AS text, LINEAR.ST_Set_Pt_Measure(a.geometry, SDO_GEOMETRY(3301,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1,1),SDO_ORDINATE_ARRAY(8,10,22)),20) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Clip by distance' AS text, LINEAR.ST_Clip(a.geometry, 5, 10, 'L', 0.0005, 0) AS Geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Clip by measure' AS text, LINEAR.ST_Clip(a.geometry, 5, 10, 'M', 0.0005, 0) AS Geom FROM lrs_routes a UNION ALL SELECT 'SDO_LRS CLIP_GEOM_SEGMENT by measure' AS text, LINEAR.ST_RoundOrdinates(SDO_LRS.CLIP_GEOM_SEGMENT (a.geometry, 5, 10, 0.0005),3) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Offset_Geom_Segment 5-10' AS text, LINEAR.ST_OFFSET_GEOM_SEGMENT(a.geometry, 5, 10, 2, 0.0005) AS geom FROM lrs_routes a UNION ALL SELECT 'SDO_LRS OFFSET_GEOM_SEGMENT measured segment 5-10' AS text, LINEAR.ST_RoundOrdinates(SDO_LRS.OFFSET_GEOM_SEGMENT (a.geometry, 5, 10, 2, 0.0005),3) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR St_Offset_Geom_Segment measured segment 5-20' AS text, LINEAR.ST_OFFSET_GEOM_SEGMENT(a.geometry, 5, 20, 2, 0.0005) AS geom FROM lrs_routes a UNION ALL SELECT 'SDO_LRS OFFSET_GEOM_SEGMENT measured segment 5-20' AS text, LINEAR.ST_RoundOrdinates(SDO_LRS.OFFSET_GEOM_SEGMENT(a.geometry, 5, 20, 2, 0.0005),3) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Reset_Measure' AS text, LINEAR.ST_Reset_Measure(a.geometry) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_convert_to_lrs_geom' AS text, LINEAR.ST_convert_to_lrs_geom(a.geometry,0,27,0.005) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Define_Geom_Segment (SDO_LRS Wrapper)' AS text, LINEAR.ST_Define_Geom_Segment(a.geometry,0,27) AS geom FROM lrs_routes a UNION ALL SELECT 'SDO_LRS SCALE_GEOM_SEGMENT' AS text, SDO_LRS.SCALE_GEOM_SEGMENT(a.geometry, 100, 200, 10) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Scale_Geom_Segment' AS text, LINEAR.ST_Scale_Geom_Segment(a.geometry, 100, 200, 10) AS geom FROM lrs_routes a UNION ALL SELECT 'LINEAR ST_Split_Geom_Segment (cf SDO_LRS.SPLIT_GEOM_SEGMENT)' || rownum AS text, s.geometry AS geom FROM lrs_routes a, TABLE(LINEAR.ST_SPLIT_GEOM_SEGMENT(a.geometry,5)) s UNION ALL SELECT 'LINEAR.ST_Concatenate_Geom_Segments' AS text, LINEAR.ST_CONCATENATE_GEOM_SEGMENTS(f1.geom1,f2.geom2,0.005) AS geom FROM (SELECT rownum AS rin, s.geometry AS geom1 FROM lrs_routes a, TABLE(LINEAR.ST_SPLIT_GEOM_SEGMENT(a.geometry,5)) s ) f1, (SELECT rownum AS rin, s.geometry AS geom2 FROM lrs_routes a, TABLE(LINEAR.ST_SPLIT_GEOM_SEGMENT(a.geometry,5)) s ) f2 WHERE f1.rin = 1 AND f2.rin = 2; -- Results -- Text GEOM ------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Original Measured geometry SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,0.0, 2.0,4.0,3.218, 8.0,4.0,12.872, 12.0,4.0,19.308, 12.0,10.0,28.962, 8.0,10.0,35.398, 5.0,14.0,43.443)) LINEAR.ST_isMeasured(3302)=1 NULL LINEAR.ST_getMeasureDimension(3302)=3 NULL LINEAR ST_Measure_Range = 43.443 NULL LINEAR ST_Start_Measure = 0 NULL LINEAR ST_End_Measure = 43.443 NULL LINEAR ST_Is_Measure_Increasing = TRUE NULL LINEAR ST_Is_Measure_Decreasing = FALSE NULL LINEAR ST_Measure_To_Percentage 18/43.443 = 41.43 NULL LINEAR ST_Percentage_To_Measure 41.43% = 17.998 NULL LINEAR.ST_Reverse_Measure SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,43.443, 2.0,4.0,35.398, 8.0,4.0,28.962, 12.0,4.0,19.308, 12.0,10.0,12.872, 8.0,10.0,3.218, 5.0,14.0,0.0)) LINEAR.ST_Set_Pt_Measure Sets 8,10 m FROM 22 TO 20 SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,0.0, 2.0,4.0,3.218, 8.0,4.0,12.872, 12.0,4.0,19.308, 12.0,10.0,28.962, 8.0,10.0,20.0, 5.0,14.0,43.443)) LINEAR ST_Clip BY distance SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(5.0,4.0,8.045, 8.0,4.0,12.872, 10.0,4.0,16.09)) LINEAR ST_Clip BY measure SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(3.108,4.0,5.0, 6.215,4.0,10.0)) SDO_LRS CLIP_GEOM_SEGMENT BY measure SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(3.108,4.0,5.0, 6.215,4.0,10.0)) LINEAR ST_Offset_Geom_Segment 5-10 SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(3.108,6.0,5.0, 6.215,6.0,10.0)) SDO_LRS OFFSET_GEOM_SEGMENT measured segment 5-10 SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(3.108,6.0,5.0, 6.215,6.0,10.0)) LINEAR St_Offset_Geom_Segment measured segment 5-20 SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(3.108,6.0,5.0, 8.0,6.0,12.872, 10.0,6.0,19.308, 10.0,4.43,20.0)) SDO_LRS OFFSET_GEOM_SEGMENT measured segment 5-20 SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(3.108,6.0,5.0, 10.761,6.0,20.0)) LINEAR ST_Reset_Measure SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,NULL, 2.0,4.0,NULL, 8.0,4.0,NULL, 12.0,4.0,NULL, 12.0,10.0,NULL, 8.0,10.0,NULL, 5.0,14.0,NULL)) LINEAR ST_convert_to_lrs_geom SDO_GEOMETRY(4402,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,0.0,0.0, 2.0,4.0,3.218,6.0, 8.0,4.0,12.872,10.0, 12.0,4.0,19.308,16.0, 12.0,10.0,28.962,20.0, 8.0,10.0,35.398,25.0, 5.0,14.0,43.443,27.0)) LINEAR ST_Define_Geom_Segment (SDO_LRS Wrapper) SDO_GEOMETRY(4402,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,0.0,0.0, 2.0,4.0,3.218,6.0, 8.0,4.0,12.872,10.0, 12.0,4.0,19.308,16.0, 12.0,10.0,28.962,20.0, 8.0,10.0,35.398,25.0, 5.0,14.0,43.443,27.0)) SDO_LRS SCALE_GEOM_SEGMENT SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,110.0, 2.0,4.0,117.407407407407, 8.0,4.0,139.62962962963, 12.0,4.0,154.444444444444, 12.0,10.0,176.666666666667, 8.0,10.0,191.481481481481, 5.0,14.0,210.0)) LINEAR ST_Scale_Geom_Segment SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,100.0, 2.0,4.0,117.407407407407, 8.0,4.0,139.62962962963, 12.0,4.0,154.444444444444, 12.0,10.0,176.666666666667, 8.0,10.0,191.481481481481, 5.0,14.0,210.0)) LINEAR ST_Split_Geom_Segment (cf SDO_LRS.SPLIT_GEOM_SEGMENT)1 SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,0.0, 2.0,4.0,3.218, 3.11,4.0,5.0)) LINEAR ST_Split_Geom_Segment (cf SDO_LRS.SPLIT_GEOM_SEGMENT)2 SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(3.11,4.0,5.0, 8.0,4.0,12.872, 12.0,4.0,19.308, 12.0,10.0,28.962, 8.0,10.0,35.398, 5.0,14.0,43.443)) LINEAR.ST_Concatenate_Geom_Segments SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,0.0, 2.0,4.0,3.218, 3.11,4.0,5.0, 8.0,4.0,12.872, 12.0,4.0,19.308, 12.0,10.0,28.962, 8.0,10.0,35.398, 5.0,14.0,43.443)) . 27 ROWS
The source code is available for download via the Download Code, Packages and Installers link on the home page of this website.
Documentation
- MySQL Spatial General Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions