User's Guide and Reference

LocateBetween

LocateBetween takes a geometry object and two measure locations and returns a geometry that represents the set of disconnected paths between the two measure locations.

Syntax

db2gse.LocateBetween(g db2gse.ST_Geometry, adistance Double, anotherdistance Double)

Return type

db2gse.ST_Geometry

Examples

The following CREATE TABLE statement creates the LOCATEBETWEEN_TEST table. LOCATEBETWEEN_TEST has two columns: the GID column, which uniquely identifies each row, and the G1 multilinestring column, which stores the sample geometry.

CREATE TABLE LOCATEBETWEEN_TEST (gid integer, g1 db2gse.ST_Geometry)

The following INSERT statements insert two rows into the LOCATEBETWEEN_TEST table. The first row is a multilinestring, and the second is a multipoint.

INSERT INTO db2gse.LOCATEBETWEEN_TEST
VALUES(1,db2gse.ST_MLineFromText('multilinestring m ((10.29 19.23 5,23.82 20.29 6,
                                           30.19 18.47 7,45.98 20.74 8),
                                          (23.82 20.29 6,30.98 23.98 7,
                                           42.92 25.98 8))',
                      db2gse.coordref()..srid(0)))
 
INSERT INTO db2gse.LOCATEBETWEEN_TEST
VALUES(2, db2gse.ST_MPointFromText('multipoint m (10.29 19.23 5,23.82 20.29 6,
30.19 18.47 7,45.98 20.74 8,23.82 20.29 6,
30.98 23.98 7,42.92 25.98 8)',
                        db2gse.coordref()..srid(0)))

The following SELECT statement and corresponding result set show how the LocateBetween function locates measures lying between measures 6.5 and 7.5 inclusive. The first row returns a multilinestring containing several linestrings. The second row returns a multipoint because the source data was multipoint. When the source data has a dimension of 0 (point or multipoint), an exact match is required.

SELECT gid, CAST(db2gse.ST_AsText(db2gse.LocateBetween (g1,6.5,7.5))
       AS varchar(96)) "Geometry"
FROM LOCATEBETWEEN_TEST
 
GID         Geometry
----------- -------------------------------------------------------------------
          1 MULTILINESTRING M ( 27.01000000 19.38000000 6.50000000, 31.19000000
18.47000000 7.00000000,38.09000000 19.61000000 7.50000000),(27.40000000 22.1400
0000 6.50000000, 30.98000000 23.98000000 7.00000000,36.95000000 24.98000000 7.5
0000000)
          2 MULTIPOINT M ( 30.19000000 18.47000000 7.00000000, 30.98000000 23.9
8000000 7.00000000)
 
  2 record(s) selected. 


[ Top of Page | Previous Page | Next Page ]