Skip Headers

Oracle® Spatial User's Guide and Reference
Release 9.2
Part No. A96630-01
Go To Documentation Library
Library
Go To Product List
Product
Go To Table Of Contents
Contents

Master Index
Go To Index
Index

Feedback

Previous Next

14
Linear Referencing Functions

The MDSYS.SDO_LRS package contains functions that create, modify, query, and convert linear referencing elements. These functions do not change the state of the database.


Note:

Most Oracle LRS interfaces are functions. Any that are procedures, such as DEFINE_GEOM_SEGMENT, are identified as such. (Functions return a value; procedures do not return a value.)

The word functions is often used to refer to LRS interfaces (both functions and procedures) collectively.


To use the functions in this chapter, you must understand the linear referencing system (LRS) concepts and techniques described in Chapter 6.

Table 14-1 lists functions related to creating and editing geometric segments.

Table 14-1 Functions for Creating and Editing Geometric Segments

Function Description
SDO_LRS.DEFINE_GEOM_SEGMENT (procedure) Defines a geometric segment.
SDO_LRS.REDEFINE_GEOM_SEGMENT (procedure) Populates the measures of all shape points of a geometric segment based on the start and end measures, overriding any previously assigned measures between the start point and end point.
SDO_LRS.CLIP_GEOM_SEGMENT   Clips a geometric segment (synonym of SDO_LRS.DYNAMIC_SEGMENT).
SDO_LRS.DYNAMIC_SEGMENT   Clips a geometric segment (synonym of SDO_LRS.CLIP_GEOM_SEGMENT).
SDO_LRS.CONCATENATE_GEOM_SEGMENTS   Concatenates two geometric segments into one segment.
SDO_LRS.OFFSET_GEOM_SEGMENT   Returns the geometric segment at a specified offset from a geometric segment.
SDO_LRS.SCALE_GEOM_SEGMENT   Scales a geometric segment.
SDO_LRS.SPLIT_GEOM_SEGMENT (procedure) Splits a geometric segment into two segments.
SDO_LRS.REVERSE_MEASURE   Returns a new geometric segment by reversing the original geometric segment.
SDO_LRS.TRANSLATE_MEASURE   Returns a new geometric segment by translating the original geometric segment (that is, shifting the start and end measures by a specified value).
SDO_LRS.REVERSE_GEOMETRY   Returns a new geometric segment by reversing the measure values and the direction of the original geometric segment.

Table 14-2 lists functions related to querying geometric segments.

Table 14-2 Functions for Querying Geometric Segments

Function Description
SDO_LRS.VALID_GEOM_SEGMENT   Checks if a geometric segment is valid.
SDO_LRS.VALID_LRS_PT   Checks if an LRS point is valid.
SDO_LRS.VALID_MEASURE   Checks if a measure falls within the measure range of a geometric segment.
SDO_LRS.CONNECTED_GEOM_SEGMENTS   Checks if two geometric segments are connected.
SDO_LRS.GEOM_SEGMENT_LENGTH   Returns the length of a geometric segment.
SDO_LRS.GEOM_SEGMENT_START_PT   Returns the start point of a geometric segment.
SDO_LRS.GEOM_SEGMENT_END_PT   Returns the end point of a geometric segment.
SDO_LRS.GEOM_SEGMENT_START_MEASURE   Returns the start measure of a geometric segment.
SDO_LRS.GEOM_SEGMENT_END_MEASURE   Returns the end measure of a geometric segment.
SDO_LRS.GET_MEASURE   Returns the measure of an LRS point.
SDO_LRS.MEASURE_RANGE   Returns the measure range of a geometric segment, that is, the difference between the start measure and end measure.
SDO_LRS.MEASURE_TO_PERCENTAGE   Returns the percentage (0 to 100) that a specified measure is of the measure range of a geometric segment.
SDO_LRS.PERCENTAGE_TO_MEASURE   Returns the measure value of a specified percentage (0 to 100) of the measure range of a geometric segment.
SDO_LRS.LOCATE_PT   Finds the location of a point described by a measure and an offset on a geometric segment.
SDO_LRS.PROJECT_PT   Returns the projection point of a point on a geometric segment.
SDO_LRS.FIND_LRS_DIM_POS   Returns the position of the measure dimension within the SDO_DIM_ARRAY structure for a specified SDO_GEOMETRY column.
SDO_LRS.FIND_MEASURE   Returns the measure of the closest point on a segment to a specified projection point.

Table 14-3 lists functions related to converting geometric segments.

Table 14-3 Functions for Converting Geometric Segments

Function Description
SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY   Converts a standard dimensional array to a Linear Referencing System dimensional array by creating a measure dimension.
SDO_LRS.CONVERT_TO_LRS_GEOM   Converts a standard SDO_GEOMETRY line string to a Linear Referencing System geometric segment by adding measure information.
SDO_LRS.CONVERT_TO_LRS_LAYER   Converts all geometry objects in a column of type SDO_GEOMETRY from standard line string geometries without measure information to Linear Referencing System geometric segments with measure information, and updates the metadata.
SDO_LRS.CONVERT_TO_STD_DIM_ARRAY   Converts a Linear Referencing System dimensional array to a standard dimensional array by removing the measure dimension.
SDO_LRS.CONVERT_TO_STD_GEOM   Converts a Linear Referencing System geometric segment to a standard SDO_GEOMETRY line string by removing measure information.
SDO_LRS.CONVERT_TO_STD_LAYER   Converts all geometry objects in a column of type SDO_GEOMETRY from Linear Referencing System geometric segments with measure information to standard line string geometries without measure information, and updates the metadata.

For more information about conversion functions, see Section 6.5.10.

The rest of this chapter provides reference information on the functions, listed in alphabetical order.


SDO_LRS.CLIP_GEOM_SEGMENT

Format

SDO_LRS.CLIP_GEOM_SEGMENT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     start_measure IN NUMBER,

     end_measure IN NUMBER

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.CLIP_GEOM_SEGMENT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     start_measure IN NUMBER,

     end_measure IN NUMBER

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Returns the geometry object resulting from a clip operation on a geometric segment.


Note:

SDO_LRS.CLIP_GEOM_SEGMENT and SDO_LRS.DYNAMIC_SEGMENT are synonyms: both functions have the same parameters, behavior, and return value.

Parameters

geom_segment

Cartographic representation of a linear feature.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

start_measure

Start measure of the geometric segment.

end_measure

End measure of the geometric segment.

Usage Notes

An exception is raised if geom_segment, start_measure, or end_measure is invalid.

start_measure and end_measure can be any points on the geometric segment. They do not have to be in any specific order. For example, start_measure and end_measure can be 5 and 10, respectively, or 10 and 5, respectively.

The direction and measures of the resulting geometric segment are preserved (that is, they reflect the original segment).

The _3D format of this function (SDO_LRS.CLIP_GEOM_SEGMENT_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

For more information about clipping geometric segments, see Section 6.5.3.

Examples

The following example clips the geometric segment representing Route 1, returning the segment from measures 5 through 10. This segment might represent a construction zone. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.CLIP_GEOM_SEGMENT(route_geometry, 5, 10)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.CLIP_GEOM_SEGMENT(ROUTE_GEOMETRY,5,10)(SDO_GTYPE, SDO_SRID, SDO_POINT(X,
--------------------------------------------------------------------------------
SDO_GEOMETRY(3302, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
5, 4, 5, 8, 4, 8, 10, 4, 10))

SDO_LRS.CONCATENATE_GEOM_SEGMENTS

Format

SDO_LRS.CONCATENATE_GEOM_SEGMENTS(

     geom_segment_1 IN MDSYS.SDO_GEOMETRY,

     geom_segment_2 IN MDSYS.SDO_GEOMETRY,

     tolerance IN NUMBER

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.CONCATENATE_GEOM_SEGMENTS(

     geom_segment_1 IN MDSYS.SDO_GEOMETRY,

     dim_array_1 IN MDSYS.SDO_DIM_ARRAY,

     geom_segment_2 IN MDSYS.SDO_GEOMETRY,

     dim_array_2 IN MDSYS.SDO_DIM_ARRAY

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Returns the geometry object resulting from the concatenation of two geometric segments.

Parameters

geom_segment_1

First geometric segment to be concatenated.

dim_array_1

Dimensional information array corresponding to geom_segment_1, usually selected from one of the xxx_SDO_GEOM_METADATA views.

geom_segment_2

Second geometric segment to be concatenated.

dim_array_2

Dimensional information array corresponding to geom_segment_2, usually selected from one of the xxx_SDO_GEOM_METADATA views.

tolerance

Tolerance value (see Section 1.5.5).

Usage Notes

An exception is raised if geom_segment_1 or geom_segment_2 has an invalid geometry type or dimensionality, or if geom_segment_1 and geom_segment_2 are based on different coordinate systems.

The direction of the first geometric segment is preserved, and all measures of the second segment are shifted so that its start measure is the same as the end measure of the first segment.

The _3D format of this function (SDO_LRS.CONCATENATE_GEOM_SEGMENTS_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

For more information about concatenating geometric segments, see Section 6.5.5

Examples

The following example defines the geometric segment, splits it into two segments, then concatenates those segments. (This example uses the definitions from the example in Section 6.6. The definitions of result_geom_1, result_geom_2, and result_geom_3 are displayed in Example 6-3.)

DECLARE
geom_segment MDSYS.SDO_GEOMETRY;
line_string MDSYS.SDO_GEOMETRY;
dim_array MDSYS.SDO_DIM_ARRAY;
result_geom_1 MDSYS.SDO_GEOMETRY;
result_geom_2 MDSYS.SDO_GEOMETRY;
result_geom_3 MDSYS.SDO_GEOMETRY;

BEGIN

SELECT a.route_geometry into geom_segment FROM lrs_routes a
  WHERE a.route_name = 'Route1';
SELECT m.diminfo into dim_array from 
  user_sdo_geom_metadata m
  WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY';

-- Define the LRS segment for Route1.
SDO_LRS.DEFINE_GEOM_SEGMENT (geom_segment, 
  dim_array,
  0,    -- Zero starting measure: LRS segment starts at start of route.
  27);  -- End of LRS segment is at measure 27.

SELECT a.route_geometry INTO line_string FROM lrs_routes a 
  WHERE a.route_name = 'Route1';

-- Split Route1 into two segments.
SDO_LRS.SPLIT_GEOM_SEGMENT(line_string,dim_array,5,result_geom_1,result_geom_2);

-- Concatenate the segments that were just split.
result_geom_3 := SDO_LRS.CONCATENATE_GEOM_SEGMENTS(result_geom_1, dim_array, result_geom_2, dim_array);

-- Insert geometries into table, to display later.
INSERT INTO lrs_routes VALUES(
  11,
  'result_geom_1',
  result_geom_1
);
INSERT INTO lrs_routes VALUES(
  12,
  'result_geom_2',
  result_geom_2
);
INSERT INTO lrs_routes VALUES(
  13,
  'result_geom_3',
  result_geom_3
);

END;
/

SDO_LRS.CONNECTED_GEOM_SEGMENTS

Format

SDO_LRS.CONNECTED_GEOM_SEGMENTS(

     geom_segment_1 IN MDSYS.SDO_GEOMETRY,

     geom_segment_2 IN MDSYS.SDO_GEOMETRY,

     tolerance IN NUMBER

     ) RETURN VARCHAR2;

or

SDO_LRS.CONNECTED_GEOM_SEGMENTS(

     geom_segment_1 IN MDSYS.SDO_GEOMETRY,

     dim_array_1 IN MDSYS.SDO_DIM_ARRAY,

     geom_segment_2 IN MDSYS.SDO_GEOMETRY,

     dim_array_2 IN MDSYS.SDO_DIM_ARRAY

     ) RETURN VARCHAR2;

Description

Checks if two geometric segments are spatially connected.

Parameters

geom_segment_1

First of two geometric segments to be checked.

dim_array_1

Dimensional information array corresponding to geom_segment_1, usually selected from one of the xxx_SDO_GEOM_METADATA views.

geom_segment_2

Second of two geometric segments to be checked.

dim_array_2

Dimensional information array corresponding to geom_segment_2, usually selected from one of the xxx_SDO_GEOM_METADATA views.

tolerance

Tolerance value (see Section 1.5.5).

Usage Notes

This function returns TRUE if the geometric segments are spatially connected and FALSE if the geometric segments are not spatially connected.

An exception is raised if geom_segment_1 or geom_segment_2 has an invalid geometry type or dimensionality, or if geom_segment_1 and geom_segment_2 are based on different coordinate systems.

The _3D format of this function (SDO_LRS.CONNECTED_GEOM_SEGMENTS_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example checks if two geometric segments (results of a previous split operation) are spatially connected.

-- Are result_geom_1 and result_geom2 connected? 
SELECT  SDO_LRS.CONNECTED_GEOM_SEGMENTS(a.route_geometry,
           b.route_geometry, 0.005)
  FROM lrs_routes a, lrs_routes b
  WHERE a.route_id = 11 AND b.route_id = 12;

SDO_LRS.CONNECTED_GEOM_SEGMENTS(A.ROUTE_GEOMETRY,B.ROUTE_GEOMETRY,0.005)        
--------------------------------------------------------------------------------
TRUE

SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY

Format

SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY(

     dim_array IN MDSYS.SDO_DIM_ARRAY

     [, lower_bound IN NUMBER,

     upper_bound IN NUMBER,

     tolerance IN NUMBER]

     ) RETURN MDSYS.SDO_DIM_ARRAY;

or

SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY(

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     dim_name IN VARCHAR2

     [, lower_bound IN NUMBER,

     upper_bound IN NUMBER,

     tolerance IN NUMBER]

     ) RETURN MDSYS.SDO_DIM_ARRAY;

or

SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY(

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     dim_name IN VARCHAR2,

     dim_pos IN INTEGER

     [, lower_bound IN NUMBER,

     upper_bound IN NUMBER,

     tolerance IN NUMBER]

     ) RETURN MDSYS.SDO_DIM_ARRAY;

Description

Converts a standard dimensional array to a Linear Referencing System dimensional array by creating a measure dimension.

Parameters

dim_array

Dimensional information array corresponding to the layer (column of geometries) to be converted, usually selected from one of the xxx_SDO_GEOM_METADATA views.

dim_name

Name of the measure dimension (M, if not otherwise specified).

dim_pos

Position of the measure dimension (the last SDO_DIM_ELEMENT object position in the SDO_DIM_ARRAY, if not otherwise specified).

lower_bound

Lower bound (SDO_LB value in the SDO_DIM_ELEMENT definition) of the ordinate in the measure dimension.

upper_bound

Upper bound (SDO_UB value in the SDO_DIM_ELEMENT definition) of the ordinate in the measure dimension.

tolerance

Tolerance value (see Section 1.5.5).

Usage Notes

This function converts a standard dimensional array to a Linear Referencing System dimensional array by creating a measure dimension. Specifically, it adds an SDO_DIM_ELEMENT object at the end of the current SDO_DIM_ELEMENT objects in the SDO_DIM_ARRAY for the diminfo (unless another dim_pos is specified), and sets the SDO_DIMNAME value in this added SDO_DIM_ELEMENT to M (unless another dim_name is specified). It sets the other values in the added SDO_DIM_ELEMENT according to the values if the upper_bound, lower_bound, and tolerance parameter values.

If dim_array already contains dimensional information, the dim_array is returned.

The _3D format of this function (SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

For more information about conversion functions, see Section 6.5.10.

Examples

The following example converts the dimensional array for the LRS_ROUTES table to Linear Referencing System format. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY(m.diminfo)
   FROM user_sdo_geom_metadata m
   WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY';

SDO_LRS.CONVERT_TO_LRS_DIM_ARRAY(M.DIMINFO)(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOL
--------------------------------------------------------------------------------
SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 20, .005), SDO_DIM_ELEMENT('Y', 0, 20, .00
5), SDO_DIM_ELEMENT('M', 0, 20, .005))

SDO_LRS.CONVERT_TO_LRS_GEOM

Format

SDO_LRS.CONVERT_TO_LRS_GEOM(

     standard_geom IN MDSYS.SDO_GEOMETRY

     [, start_measure IN NUMBER,

     end_measure IN NUMBER]

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.CONVERT_TO_LRS_GEOM(

     standard_geom IN MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY

     [, start_measure IN NUMBER,

     end_measure IN NUMBER]

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.CONVERT_TO_LRS_GEOM(

     standard_geom IN MDSYS.SDO_GEOMETRY,

     m_pos IN INTEGER

     [, start_measure IN NUMBER,

     end_measure IN NUMBER]

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Converts a standard SDO_GEOMETRY line string to a Linear Referencing System geometric segment by adding measure information.

Parameters

standard_geom

Line string geometry that does not contain measure information.

dim_array

Dimensional information array corresponding to standard_geom, usually selected from one of the xxx_SDO_GEOM_METADATA views.

m_pos

Position of the measure dimension. If specified, must be 3 or 4. By default, the measure dimension is the last dimension in the SDO_DIM_ARRAY.

start_measure

Distance measured from the start point of a geometric segment to the start point of the linear feature. The default is 0.

end_measure

Distance measured from the end point of a geometric segment to the start point of the linear feature. The default is the cartographic length (for example, 75 if the cartographic length is 75 miles and the unit of measure is miles).

Usage Notes

This function returns a Linear Referencing System geometric segment with measure information, with measure information provided for all shape points.

An exception is raised if standard_geom has an invalid geometry type or dimensionality, if m_pos is less than 3 or greater than 4, or if start_measure or end_measure is out of range.

The _3D format of this function (SDO_LRS.CONVERT_TO_LRS_GEOM_3D) is available; however, the m_pos parameter is not available for SDO_LRS.CONVERT_TO_LRS_GEOM_3D. For information about _3D formats of LRS functions, see Section 6.4.

For more information about conversion functions, see Section 6.5.10.

Examples

The following example converts the geometric segment representing Route 1 to Linear Referencing System format. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.CONVERT_TO_LRS_GEOM(a.route_geometry, m.diminfo)
  FROM lrs_routes a, user_sdo_geom_metadata m
  WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY'
    AND a.route_id = 1;

SDO_LRS.CONVERT_TO_LRS_GEOM(A.ROUTE_GEOMETRY,M.DIMINFO)(SDO_GTYPE, SDO_SRID, SDO
--------------------------------------------------------------------------------
SDO_GEOMETRY(3002, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
2, 2, 0, 2, 4, 2, 8, 4, 8, 12, 4, 12, 12, 10, NULL, 8, 10, 22, 5, 14, 27))

SDO_LRS.CONVERT_TO_LRS_LAYER

Format

SDO_LRS.CONVERT_TO_LRS_LAYER(

     table_name IN VARCHAR2,

     column_name IN VARCHAR2

     [, lower_bound IN NUMBER,

     upper_bound IN NUMBER,

     tolerance IN NUMBER]

     ) RETURN VARCHAR2;

or

SDO_LRS.CONVERT_TO_LRS_LAYER(

     table_name IN VARCHAR2,

     column_name IN VARCHAR2,

     dim_name IN VARCHAR2,

     dim_pos IN INTEGER

     [, lower_bound IN NUMBER,

     upper_bound IN NUMBER,

     tolerance IN NUMBER]

     ) RETURN VARCHAR2;

Description

Converts all geometry objects in a column of type SDO_GEOMETRY (that is, converts a layer) from standard line string geometries without measure information to Linear Referencing System geometric segments with measure information, and updates the metadata in the USER_SDO_GEOM_METADATA view.

Parameters

table_name

Table containing the column with the SDO_GEOMETRY objects.

column_name

Column in table_name containing the SDO_GEOMETRY objects.

dim_name

Name of the measure dimension. If this parameter is null, M is assumed.

dim_pos

Position of the measure dimension within the SDO_DIM_ARRAY structure for the specified SDO_GEOMETRY column. If this parameter is null, the number corresponding to the last position is assumed.

lower_bound

Lower bound (SDO_LB value in the SDO_DIM_ELEMENT definition) of the ordinate in the measure dimension.

upper_bound

Upper bound (SDO_UB value in the SDO_DIM_ELEMENT definition) of the ordinate in the measure dimension.

tolerance

Tolerance value (see Section 1.5.5).

Usage Notes

This function returns TRUE if the conversion was successful or if the layer already contains measure information, and the function returns an exception if the conversion was not successful.

An exception is raised if the existing dimensional information for the table is invalid.

The measure values are assigned based on a start measure of zero and an end measure of the cartographic length.

If a spatial index already exists on column_name, you must delete (drop) the index before converting the layer and create a new index after converting the layer. For information about deleting and creating indexes, see the DROP INDEX and CREATE INDEX statements in Chapter 8.

The _3D format of this function (SDO_LRS.CONVERT_TO_LRS_LAYER_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

For more information about conversion functions, see Section 6.5.10.

Examples

The following example converts the geometric segments in the ROUTE_GEOMETRY column of the LRS_ROUTES table to Linear Referencing System format. (This example uses the definitions from the example in Section 6.6.) The SELECT statement shows that dimensional information has been added (that is, SDO_DIM_ELEMENT('M', NULL, NULL, NULL) is included in the definition).

BEGIN
  IF (SDO_LRS.CONVERT_TO_LRS_LAYER('LRS_ROUTES', 'ROUTE_GEOMETRY') =  'TRUE')
     THEN
       DBMS_OUTPUT.PUT_LINE('Conversion from STD_LAYER to LRS_LAYER succeeded');
     ELSE
       DBMS_OUTPUT.PUT_LINE('Conversion from STD_LAYER to LRS_LAYER failed');
  END IF;
END;
.
/
Conversion from STD_LAYER to LRS_LAYER succeeded       

PL/SQL procedure successfully completed.

SQL> SELECT diminfo FROM user_sdo_geom_metadata WHERE table_name = 'LRS_ROUTES' AND column_name = 'ROUTE_GEOMETRY';

DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)                             
--------------------------------------------------------------------------------
SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 20, .005), SDO_DIM_ELEMENT('Y', 0, 20, .00
5), SDO_DIM_ELEMENT('M', NULL, NULL, NULL))

SDO_LRS.CONVERT_TO_STD_DIM_ARRAY

Format

SDO_LRS.CONVERT_TO_STD_DIM_ARRAY(

     dim_array IN MDSYS.SDO_DIM_ARRAY

     [, m_pos IN INTEGER]

     ) RETURN MDSYS.SDO_DIM_ARRAY;

Description

Converts a Linear Referencing System dimensional array to a standard dimensional array by removing the measure dimension.

Parameters

dim_array

Dimensional information array corresponding to the layer (column of geometries) to be converted, usually selected from one of the xxx_SDO_GEOM_METADATA views.

m_pos

Position of the measure dimension. If specified, must be 3 or 4. By default, the measure dimension is the last dimension in the SDO_DIM_ARRAY.

Usage Notes

This function converts a Linear Referencing System dimensional array to a standard dimensional array by removing the measure dimension. Specifically, it removes the SDO_DIM_ELEMENT object at the end of the current SDO_DIM_ELEMENT objects in the SDO_DIM_ARRAY for the diminfo.

An exception is raised if m_pos is invalid (less than 3 or greater than 4).

If dim_array is already a standard dimensional array (that is, does not contain dimensional information), the dim_array is returned.

The _3D format of this function (SDO_LRS.CONVERT_TO_STD_DIM_ARRAY_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

For more information about conversion functions, see Section 6.5.10.

Examples

The following example converts the dimensional array for the LRS_ROUTES table to standard format. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.CONVERT_TO_STD_DIM_ARRAY(m.diminfo)
   FROM user_sdo_geom_metadata m
   WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY';

SDO_LRS.CONVERT_TO_STD_DIM_ARRAY(M.DIMINFO)(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOL
--------------------------------------------------------------------------------
SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 20, .005), SDO_DIM_ELEMENT('Y', 0, 20, .00
5))

SDO_LRS.CONVERT_TO_STD_GEOM

Format

SDO_LRS.CONVERT_TO_STD_GEOM(

     lrs _geom IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Converts a Linear Referencing System geometric segment to a standard SDO_GEOMETRY line string by removing measure information.

Parameters

lrs_geom

Linear Referencing System geometry that contains measure information.

dim_array

Dimensional information array corresponding to lrs_geom, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns an SDO_GEOMETRY object in which all measure information is removed.

The _3D format of this function (SDO_LRS.CONVERT_TO_STD_GEOM_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

For more information about conversion functions, see Section 6.5.10.

Examples

The following example converts the geometric segment representing Route 1 to standard format. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.CONVERT_TO_STD_GEOM(a.route_geometry, m.diminfo)
  FROM lrs_routes a, user_sdo_geom_metadata m
  WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY'
    AND a.route_id = 1;

SDO_LRS.CONVERT_TO_STD_GEOM(A.ROUTE_GEOMETRY,M.DIMINFO)(SDO_GTYPE, SDO_SRID, SDO
--------------------------------------------------------------------------------
SDO_GEOMETRY(2002, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
2, 2, 2, 4, 8, 4, 12, 4, 12, 10, 8, 10, 5, 14))

SDO_LRS.CONVERT_TO_STD_LAYER

Format

SDO_LRS.CONVERT_TO_STD_LAYER(

     table_name IN VARCHAR2,

     column_name IN VARCHAR2

     ) RETURN VARCHAR2;

Description

Converts all geometry objects in a column of type SDO_GEOMETRY (that is, converts a layer) from Linear Referencing System geometric segments with measure information to standard line string geometries without measure information, and updates the metadata in the USER_SDO_GEOM_METADATA view.

Parameters

table_name

Table containing the column with the SDO_GEOMETRY objects.

column_name

Column in table_name containing the SDO_GEOMETRY objects.

Usage Notes

This function returns TRUE if the conversion was successful or if the layer already is a standard layer (that is, contains geometries without measure information), and the function returns an exception if the conversion was not successful.

An exception is raised if the conversion failed.

If a spatial index already exists on column_name, you must delete (drop) the index before converting the layer and create a new index after converting the layer. For information about deleting and creating indexes, see the DROP INDEX and CREATE INDEX statements in Chapter 8.

The _3D format of this function (SDO_LRS.CONVERT_TO_STD_LAYER_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

For more information about conversion functions, see Section 6.5.10.

Examples

The following example converts the geometric segments in the ROUTE_GEOMETRY column of the LRS_ROUTES table to standard format. (This example uses the definitions from the example in Section 6.6.) The SELECT statement shows that dimensional information has been removed (that is, no SDO_DIM_ELEMENT('M', NULL, NULL, NULL) is included in the definition).

BEGIN
  IF (SDO_LRS.CONVERT_TO_STD_LAYER('LRS_ROUTES', 'ROUTE_GEOMETRY') =  'TRUE')
     THEN
       DBMS_OUTPUT.PUT_LINE('Conversion from LRS_LAYER to STD_LAYER succeeded');
     ELSE
       DBMS_OUTPUT.PUT_LINE('Conversion from LRS_LAYER to STD_LAYER failed');
  END IF;
END;
.
/
Conversion from LRS_LAYER to STD_LAYER succeeded

PL/SQL procedure successfully completed.

SELECT diminfo FROM user_sdo_geom_metadata 
   WHERE table_name = 'LRS_ROUTES' AND column_name = 'ROUTE_GEOMETRY';

DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)                             
--------------------------------------------------------------------------------
SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 20, .005), SDO_DIM_ELEMENT('Y', 0, 20, .00
5))   

SDO_LRS.DEFINE_GEOM_SEGMENT

Format

SDO_LRS.DEFINE_GEOM_SEGMENT(

     geom_segment IN OUT MDSYS.SDO_GEOMETRY

     [, start_measure IN NUMBER,

     end_measure IN NUMBER]);

or

SDO_LRS.DEFINE_GEOM_SEGMENT(

     geom_segment IN OUT MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY

     [, start_measure IN NUMBER,

     end_measure IN NUMBER]);

Description

Defines a geometric segment by assigning start and end measures to a geometric segment, and assigns values to any null measures. (This is a procedure, not a function.)

Parameters

geom_segment

Cartographic representation of a linear feature.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

start_measure

Distance measured from the start point of a geometric segment to the start point of the linear feature. The default is the existing value (if any) in the measure dimension; otherwise, the default is 0.

end_measure

Distance measured from the end point of a geometric segment to the start point of the linear feature. The default is the existing value (if any) in the measure dimension; otherwise, the default is the cartographic length of the segment.

Usage Notes

An exception is raised if geom_segment has an invalid geometry type or dimensionality, or if start_measure or end_measure is out of range.

All unassigned measures of the geometric segment will be populated automatically.

To store the resulting geometric segment (geom_segment) in the database, you must execute and UPDATE or INSERT statement, as appropriate.

The _3D format of this procedure (SDO_LRS.DEFINE_GEOM_SEGMENT_3D) is available. For information about _3D formats of LRS functions and procedures, see Section 6.4.

For more information about defining a geometric segment, see Section 6.5.1

Examples

The following example defines the geometric segment, splits it into two segments, then concatenates those segments. (This example uses the definitions from the example in Section 6.6. The definitions of result_geom_1, result_geom_2, and result_geom_3 are displayed in Example 6-3.)

DECLARE
geom_segment MDSYS.SDO_GEOMETRY;
line_string MDSYS.SDO_GEOMETRY;
dim_array MDSYS.SDO_DIM_ARRAY;
result_geom_1 MDSYS.SDO_GEOMETRY;
result_geom_2 MDSYS.SDO_GEOMETRY;
result_geom_3 MDSYS.SDO_GEOMETRY;

BEGIN

SELECT a.route_geometry into geom_segment FROM lrs_routes a
  WHERE a.route_name = 'Route1';
SELECT m.diminfo into dim_array from 
  user_sdo_geom_metadata m
  WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY';

-- Define the LRS segment for Route1. This will populate any null measures.
SDO_LRS.DEFINE_GEOM_SEGMENT (geom_segment, 
  dim_array,
  0,    -- Zero starting measure: LRS segment starts at start of route.
  27);  -- End of LRS segment is at measure 27.

SELECT a.route_geometry INTO line_string FROM lrs_routes a 
  WHERE a.route_name = 'Route1';

-- Split Route1 into two segments.
SDO_LRS.SPLIT_GEOM_SEGMENT(line_string,dim_array,5,result_geom_1,result_geom_2);

-- Concatenate the segments that were just split.
result_geom_3 := SDO_LRS.CONCATENATE_GEOM_SEGMENTS(result_geom_1, dim_array, result_geom_2, dim_array);

-- Update and insert geometries into table, to display later.
UPDATE lrs_routes a SET a.route_geometry = geom_segment
   WHERE a.route_id = 1;

INSERT INTO lrs_routes VALUES(
  11,
  'result_geom_1',
  result_geom_1
);
INSERT INTO lrs_routes VALUES(
  12,
  'result_geom_2',
  result_geom_2
);
INSERT INTO lrs_routes VALUES(
  13,
  'result_geom_3',
  result_geom_3
);

END;
/

SDO_LRS.DYNAMIC_SEGMENT

Format

SDO_LRS.DYNAMIC_SEGMENT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     start_measure IN NUMBER,

     end_measure IN NUMBER

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.DYNAMIC_SEGMENT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     start_measure IN NUMBER,

     end_measure IN NUMBER

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Returns the geometry object resulting from a clip operation on a geometric segment.


Note:

SDO_LRS.CLIP_GEOM_SEGMENT and SDO_LRS.DYNAMIC_SEGMENT are synonyms: both functions have the same parameters, behavior, and return value.

Parameters

geom_segment

Cartographic representation of a linear feature.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

start_measure

Start measure of the geometric segment.

end_measure

End measure of the geometric segment.

Usage Notes

An exception is raised if geom_segment, start_measure, or end_measure is invalid.

The direction and measures of the resulting geometric segment are preserved.

For more information about clipping a geometric segment, see Section 6.5.3

Examples

The following example clips the geometric segment representing Route 1, returning the segment from measures 5 through 10. This segment might represent a construction zone. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.DYNAMIC_SEGMENT(route_geometry, 5, 10)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.DYNAMIC_SEGMENT(ROUTE_GEOMETRY,5,10)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y
--------------------------------------------------------------------------------
SDO_GEOMETRY(3302, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
5, 4, 5, 8, 4, 8, 10, 4, 10))

SDO_LRS.FIND_LRS_DIM_POS

Format

SDO_LRS.FIND_LRS_DIM_POS(

     table_name IN VARCHAR2,

     column_name IN VARCHAR2

     ) RETURN INTEGER;

Description

Returns the position of the measure dimension within the SDO_DIM_ARRAY structure for a specified SDO_GEOMETRY column.

Parameters

table_name

Table containing the column with the SDO_GEOMETRY objects.

column_name

Column in table_name containing the SDO_GEOMETRY objects.

Usage Notes

None.

Examples

The following example returns the position of the measure dimension within the SDO_DIM_ARRAY structure for geometries in the ROUTE_GEOMETRY column of the LRS_ROUTES table. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.FIND_LRS_DIM_POS('LRS_ROUTES', 'ROUTE_GEOMETRY') FROM DUAL;

SDO_LRS.FIND_LRS_DIM_POS('LRS_ROUTES','ROUTE_GEOMETRY')
-------------------------------------------------------
                                                      3

SDO_LRS.FIND_MEASURE

Format

SDO_LRS.FIND_MEASURE(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     point IN MDSYS.SDO_GEOMETRY

     ) RETURN NUMBER;

or

SDO_LRS.FIND_MEASURE(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     point IN MDSYS.SDO_GEOMETRY

     ) RETURN NUMBER;

Description

Returns the measure of the closest point on a segment to a specified projection point.

Parameters

geom_segment

Cartographic representation of a linear feature. This function returns the measure of the point on this segment that is closest to the projection point.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

point

Projection point. This function returns the measure of the point on geom_segment that is closest to the projection point.

Usage Notes

This function returns the measure of the point on geom_segment that is closest to the projection point. For example, if the projection point represents a shopping mall, the function could be used to find how far from the start of the highway is the point on the highway that is closest to the shopping mall.

An exception is raised if geom_segment_1 or geom_segment_2 has an invalid geometry type or dimensionality, or if geom_segment and point are based on different coordinate systems.

The _3D format of this function (SDO_LRS.FIND_MEASURE_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example finds the measure for the point on the geometric segment representing Route 1 that is closest to the point (10, 7). (This example uses the definitions from the example in Section 6.6.)

-- Find measure for point on segment closest to 10,7
-- Should return 15 (for point 12,7)
SELECT  SDO_LRS.FIND_MEASURE(a.route_geometry, m.diminfo,
  MDSYS.SDO_GEOMETRY(3001, NULL, NULL, 
     MDSYS.SDO_ELEM_INFO_ARRAY(1, 1, 1), 
     MDSYS.SDO_ORDINATE_ARRAY(10, 7, NULL)) )
 FROM lrs_routes a, user_sdo_geom_metadata m
 WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY'
   AND a.route_id = 1;

SDO_LRS.FIND_MEASURE(A.ROUTE_GEOMETRY,M.DIMINFO,MDSYS.SDO_GEOMETRY(3001,NULL,NUL
--------------------------------------------------------------------------------
                                                                              15

SDO_LRS.GEOM_SEGMENT_END_MEASURE

Format

SDO_LRS.GEOM_SEGMENT_END_MEASURE(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN NUMBER;

Description

Returns the end measure of a geometric segment.

Parameters

geom_segment

Geometric segment whose end measure is to be returned.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns the end measure of geom_segment.

An exception is raised if geom_segment has an invalid geometry type or dimensionality.

The _3D format of this function (SDO_LRS.GEOM_SEGMENT_END_MEASURE_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example returns the end measure of the geometric segment representing Route 1. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.GEOM_SEGMENT_END_MEASURE(route_geometry)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.GEOM_SEGMENT_END_MEASURE(ROUTE_GEOMETRY)                                
------------------------------------------------                                
                                              27

SDO_LRS.GEOM_SEGMENT_END_PT

Format

SDO_LRS.GEOM_SEGMENT_END_PT(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Returns the end point of a geometric segment.

Parameters

geom_segment

Geometric segment whose end point is to be returned.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns the end point of geom_segment.

An exception is raised if geom_segment has an invalid geometry type or dimensionality.

The _3D format of this function (SDO_LRS.GEOM_SEGMENT_END_PT_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example returns the end point of the geometric segment representing Route 1. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.GEOM_SEGMENT_END_PT(route_geometry)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.GEOM_SEGMENT_END_PT(ROUTE_GEOMETRY)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y,
--------------------------------------------------------------------------------
SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(
5, 14, 27))

SDO_LRS.GEOM_SEGMENT_LENGTH

Format

SDO_LRS.GEOM_SEGMENT_LENGTH(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN NUMBER;

Description

Returns the length of a geometric segment.

Parameters

geom_segment

Geometric segment whose length is to be calculated.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns the length of geom_segment. The length is the geometric length, which is not the same as the total of the measure unit values. To determine how long a segment is in terms of measure units, subtract the result of an SDO_LRS.GEOM_SEGMENT_START_MEASURE operation from the result of an SDO_LRS.GEOM_SEGMENT_END_MEASURE operation.

An exception is raised if geom_segment has an invalid geometry type or dimensionality.

The _3D format of this function (SDO_LRS.GEOM_SEGMENT_LENGTH_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example returns the length of the geometric segment representing Route 1. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.GEOM_SEGMENT_LENGTH(route_geometry)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.GEOM_SEGMENT_LENGTH(ROUTE_GEOMETRY)                                     
-------------------------------------------                                     
                                         27

SDO_LRS.GEOM_SEGMENT_START_MEASURE

Format

SDO_LRS.GEOM_SEGMENT_START_MEASURE(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN NUMBER;

Description

Returns the start measure of a geometric segment.

Parameters

geom_segment

Geometric segment whose start measure is to be returned.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns the start measure of geom_segment.

An exception is raised if geom_segment has an invalid geometry type or dimensionality.

The _3D format of this function (SDO_LRS.GEOM_SEGMENT_START_MEASURE_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example returns the start measure of the geometric segment representing Route 1. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.GEOM_SEGMENT_START_MEASURE(route_geometry)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.GEOM_SEGMENT_START_MEASURE(ROUTE_GEOMETRY)                              
--------------------------------------------------                              
                                                 0

SDO_LRS.GEOM_SEGMENT_START_PT

Format

SDO_LRS.GEOM_SEGMENT_START_PT(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Returns the start point of a geometric segment.

Parameters

geom_segment

Geometric segment whose start point is to be returned.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns the start point of geom_segment.

An exception is raised if geom_segment has an invalid geometry type or dimensionality.

The _3D format of this function (SDO_LRS.GEOM_SEGMENT_START_PT_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example returns the start point of the geometric segment representing Route 1. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.GEOM_SEGMENT_START_PT(route_geometry)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.GEOM_SEGMENT_START_PT(ROUTE_GEOMETRY)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, 
--------------------------------------------------------------------------------
SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(
2, 2, 0))

SDO_LRS.GET_MEASURE

Format

SDO_LRS.GET_MEASURE(

     point IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN NUMBER;

Description

Returns the measure of an LRS point.

Parameters

point

Point whose measure is to be returned.

dim_array

Dimensional information array corresponding to point, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns the measure of an LRS point.

If point is not valid, an Òinvalid LRS pointÓ exception is raised.

Contrast this function with SDO_LRS.PROJECT_PT, which accepts as input a point that is not necessarily on the geometric segment, but which returns a point that is on the geometric segment, as opposed to a measure value. As the following example shows, the SDO_LRS.GET_MEASURE function can be used to return the measure of the projected point returned by SDO_LRS.PROJECT_PT.

The _3D format of this function (SDO_LRS.GET_MEASURE_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example returns the measure of a projected point. In this case, the point resulting from the projection is 9 units from the start of the segment.

SQL> SELECT SDO_LRS.GET_MEASURE(
   SDO_LRS.PROJECT_PT(a.route_geometry, m.diminfo,
    MDSYS.SDO_GEOMETRY(3001, NULL, NULL,
       MDSYS.SDO_ELEM_INFO_ARRAY(1, 1, 1),
       MDSYS.SDO_ORDINATE_ARRAY(9, 3, NULL)) ),
   m.diminfo )
   FROM lrs_routes a, user_sdo_geom_metadata m
   WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY'
       AND a.route_id = 1;

SDO_LRS.GET_MEASURE(SDO_LRS.PROJECT_PT(A.ROUTE_GEOMETRY,M.DIMINFO,MDSYS.SDO_GEOM
--------------------------------------------------------------------------------
                                                                               9

SDO_LRS.IS_GEOM_SEGMENT_DEFINED

Format

SDO_LRS.IS_GEOM_SEGMENT_DEFINED(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN VARCHAR2;

Description

Checks if an LRS segment is defined correctly.

Parameters

geom_segment

Geometric segment to be checked.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns TRUE if geom_segment is defined correctly and FALSE if geom_segment is not defined correctly.

The start and end measures of geom_segment must be defined (cannot be null), and any measures assigned must be in an ascending or descending order along the segment direction.

The _3D format of this function (SDO_LRS.IS_GEOM_SEGMENT_DEFINED_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

See also the SDO_LRS.VALID_GEOM_SEGMENT function.

Examples

The following example checks if the geometric segment representing Route 1 is defined. (This example uses the definitions from the example in Section 6.6.)

SELECT  SDO_LRS.IS_GEOM_SEGMENT_DEFINED(route_geometry)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.IS_GEOM_SEGMENT_DEFINED(ROUTE_GEOMETRY)                                 
--------------------------------------------------------------------------------
TRUE

SDO_LRS.IS_MEASURE_DECREASING

Format

SDO_LRS.IS_MEASURE_DECREASING(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN VARCHAR2;

Description

Checks if the measure values along an LRS segment are decreasing (that is, descending in numerical value).

Parameters

geom_segment

Geometric segment to be checked.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns TRUE if the measure values along an LRS segment are decreasing and FALSE if the measure values along an LRS segment are not decreasing.

The start and end measures of geom_segment must be defined (cannot be null).

The _3D format of this function (SDO_LRS.IS_MEASURE_DECREASING_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

See also the SDO_LRS.IS_MEASURE_INCREASING function.

Examples

The following example checks if the measure values along the geometric segment representing Route 1 are decreasing. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.IS_MEASURE_DECREASING(a.route_geometry, m.diminfo)
   FROM lrs_routes a, user_sdo_geom_metadata m
   WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY'
   AND a.route_id = 1;

SDO_LRS.IS_MEASURE_DECREASING(A.ROUTE_GEOMETRY,M.DIMINFO)                       
--------------------------------------------------------------------------------
FALSE

SDO_LRS.IS_MEASURE_INCREASING

Format

SDO_LRS.IS_MEASURE_INCREASING(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN VARCHAR2;

Description

Checks if the measure values along an LRS segment are increasing (that is, ascending in numerical value).

Parameters

geom_segment

Geometric segment to be checked.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function returns TRUE if the measure values along an LRS segment are increasing and FALSE if the measure values along an LRS segment are not increasing.

The start and end measures of geom_segment must be defined (cannot be null).

The _3D format of this function (SDO_LRS.IS_MEASURE_INCREASING_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

See also the SDO_LRS.IS_MEASURE_DECREASING function.

Examples

The following example checks if the measure values along the geometric segment representing Route 1 are increasing. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.IS_MEASURE_INCREASING(a.route_geometry, m.diminfo)
   FROM lrs_routes a, user_sdo_geom_metadata m
   WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY'
   AND a.route_id = 1;

SDO_LRS.IS_MEASURE_INCREASING(A.ROUTE_GEOMETRY,M.DIMINFO)                       
--------------------------------------------------------------------------------
TRUE

SDO_LRS.LOCATE_PT

Format

SDO_LRS.LOCATE_PT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     measure IN NUMBER

     [, offset IN NUMBER

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.LOCATE_PT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     measure IN NUMBER

     [, offset IN NUMBER]

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Returns the point located at a specified distance from the start of a geometric segment.

Parameters

geom_segment

Geometric segment to be checked to see if it falls within the measure range of measure.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

measure

Distance to measure from the start point of geom_segment.

offset

Distance to measure perpendicularly from the point that is located at measure units from the start point of geom_segment. The default is 0 (that is, the point is on geom_segment).

Usage Notes

This function returns the referenced point. For example, on a highway, the point might represent the location of an accident.

The unit of measurement for offset is the same as for the coordinate system associated with geom_segment. For geodetic data, the default unit of measurement is meters.

With geodetic data using the WGS 84 coordinate system, this function can be used to return the longitude and latitude coordinates of any point on or offset from the segment.

An exception is raised if geom_segment has an invalid geometry type or dimensionality, or if the location is out of range.

The _3D format of this function (SDO_LRS.LOCATE_PT_3D) is available; however, the offset parameter is not available for SDO_LRS.LOCATE_PT_3D. For information about _3D formats of LRS functions, see Section 6.4.

For more information about locating a point on a geometric segment, see Section 6.5.8.

Examples

The following example creates a table for automobile accident data, inserts a record for an accident at the point at measure 9 and on (that is, offset 0) the geometric segment representing Route 1, and displays the data. (The accident table is deliberately oversimplified. This example also uses the route definition from the example in Section 6.6.)

-- Create a table for accidentsCREATE TABLE accidents (  accident_id  NUMBER PRIMARY KEY,  route_id  NUMBER,  accident_geometry  MDSYS.SDO_GEOMETRY);-- Insert an accident record.DECLAREgeom_segment MDSYS.SDO_GEOMETRY;BEGINSELECT  SDO_LRS.LOCATE_PT(a.route_geometry, 9, 0) into geom_segment  FROM lrs_routes a WHERE a.route_name = 'Route1';INSERT INTO accidents VALUES(1, 1, geom_segment);END;/SELECT * from accidents;

ACCIDENT_ID   ROUTE_ID                                                          
----------- ----------                                                          
ACCIDENT_GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_OR
--------------------------------------------------------------------------------
          1          1                                                          
SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(
9, 4, 9))

SDO_LRS.MEASURE_RANGE

Format

SDO_LRS.MEASURE_RANGE(

     geom_segment IN MDSYS.SDO_GEOMETRY

     [, dim_array IN MDSYS.SDO_DIM_ARRAY]

     ) RETURN NUMBER;

Description

Returns the measure range of a geometric segment, that is, the difference between the start measure and end measure.

Parameters

geom_segment

Cartographic representation of a linear feature.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

Usage Notes

This function subtracts the start measure of geom_segment from the end measure of geom_segment.

The _3D format of this function (SDO_LRS.MEASURE_RANGE_3D) is available. For information about _3D formats of LRS functions, see Section 6.4.

Examples

The following example returns the measure range of the geometric segment representing Route 1. (This example uses the definitions from the example in Section 6.6.)

SELECT SDO_LRS.MEASURE_RANGE(route_geometry)
  FROM lrs_routes WHERE route_id = 1;

SDO_LRS.MEASURE_RANGE(ROUTE_GEOMETRY)                                           
-------------------------------------                                           
                                   27

SDO_LRS.MEASURE_TO_PERCENTAGE

Format

SDO_LRS.MEASURE_TO_PERCENTAGE(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     measure IN NUMBER

     ) RETURN NUMBER;

or

SDO_LRS.MEASURE_TO_PERCENTAGE(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     measure IN NUMBER

     ) RETURN NUMBER;

Description

Returns the percentage (0 to 100) that a specified measure is of the measure range of a geometric segment.

Parameters

geom_segment

Cartographic representation of a linear feature.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

measure

Measure value. This function returns the percentage that this measure value is of the measure range.

Usage Notes

This function returns a number (0 to 100) that is the percentage of the measure range that the specified measure represents. (The measure range is the end measure minus the start measure.) For example, if the measure range of geom_segment is 50 and measure is 20, the function returns 40 (because 20/50 = 40%).

This function performs the reverse of the SDO_LRS.PERCENTAGE_TO_MEASURE function, which returns the measure that corresponds to a percentage value.

An exception is raised if geom_segment or measure is invalid.

Examples

The following example returns the percentage that 5 is of the measure range of geometric segment representing Route 1. (This example uses the definitions from the example in Section 6.6.) The measure range of this segment is 27, and 5 is approximately 18.5 percent of 27.

SELECT SDO_LRS.MEASURE_TO_PERCENTAGE(a.route_geometry, m.diminfo, 5)
  FROM lrs_routes a, user_sdo_geom_metadata m
  WHERE m.table_name = 'LRS_ROUTES' AND m.column_name = 'ROUTE_GEOMETRY'
    AND a.route_id = 1;

SDO_LRS.MEASURE_TO_PERCENTAGE(A.ROUTE_GEOMETRY,M.DIMINFO,5)                     
-----------------------------------------------------------                     
                                                 18.5185185

SDO_LRS.OFFSET_GEOM_SEGMENT

Format

SDO_LRS.OFFSET_GEOM_SEGMENT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     start_measure IN NUMBER,

     end_measure IN NUMBER,

     offset IN NUMBER

     [, tolerance IN NUMBER]

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.OFFSET_GEOM_SEGMENT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     start_measure IN NUMBER,

     end_measure IN NUMBER,

     offset IN NUMBER,

     tolerance IN NUMBER

     [, unit IN VARCHAR2]

     ) RETURN MDSYS.SDO_GEOMETRY;

or

SDO_LRS.OFFSET_GEOM_SEGMENT(

     geom_segment IN MDSYS.SDO_GEOMETRY,

     dim_array IN MDSYS.SDO_DIM_ARRAY,

     start_measure IN NUMBER,

     end_measure IN NUMBER,

     offset IN NUMBER

     [, unit IN VARCHAR2]

     ) RETURN MDSYS.SDO_GEOMETRY;

Description

Returns the geometric segment at a specified offset from a geometric segment.

Parameters

geom_segment

Cartographic representation of a linear feature.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views.

start_measure

Start measure of geom_segment at which to start the offset operation.

end_measure

End measure of geom_segment at which to start the offset operation.

offset

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.