26.42 SDO_LRS.SPLIT_GEOM_SEGMENT

Format

SDO_LRS.SPLIT_GEOM_SEGMENT(
     geom_segment  IN SDO_GEOMETRY, 
     split_measure IN NUMBER, 
     segment_1     OUT SDO_GEOMETRY, 
     segment_2     OUT SDO_GEOMETRY);

or

SDO_LRS.SPLIT_GEOM_SEGMENT(
     geom_segment  IN SDO_GEOMETRY, 
     dim_array     IN SDO_DIM_ARRAY, 
     split_measure IN NUMBER, 
     segment_1     OUT SDO_GEOMETRY, 
     segment_2     OUT SDO_GEOMETRY);

Description

Splits a geometric segment into two geometric segments.

Parameters

geom_segment

Input geometric segment (LRS segment) containing measure information.

dim_array

Dimensional information array corresponding to geom_segment, usually selected from one of the xxx_SDO_GEOM_METADATA views (described in Geometry Metadata Views).

split_measure

Distance measured from the start point of a geometric segment to the split point.

segment_1

First geometric segment: from the start point of geom_segment to the split point.

segment_2

Second geometric segment: from the split point to the end point of geom_segment.

Usage Notes

An exception is raised if geom_segment or split_measure is invalid.

The directions and measures of the resulting geometric segments are preserved.

The _3D format of this procedure (SDO_LRS.SPLIT_GEOM_SEGMENT_3D) is available. For information about _3D formats of LRS functions and procedures, see 3D Formats of LRS Functions.

For more information about splitting a geometric segment, see Splitting a Geometric Segment.

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 Example of LRS Functions. The definitions of result_geom_1, result_geom_2, and result_geom_3 are displayed in Example 7-3.)

DECLARE
geom_segment SDO_GEOMETRY;
line_string SDO_GEOMETRY;
dim_array SDO_DIM_ARRAY;
result_geom_1 SDO_GEOMETRY;
result_geom_2 SDO_GEOMETRY;
result_geom_3 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;
/