User's Guide and Reference

LocateAlong

LocateAlong takes a geometry object and a measure to return as a multipoint the set of points found at the measure.

Syntax

db2gse.LocateAlong(g db2gse.ST_Geometry, adistance Double)

Return type

db2gse.ST_Geometry

Examples

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

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

The following INSERT statements insert two rows. The first is a multilinestring; the second is a multipoint.

INSERT INTO db2gse.LOCATEALONG_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.LocateAlong_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)',
                 db2gse.coordref()..srid(0))) 

In the following SELECT statement and the corresponding result set, the LocateAlong function is directed to find points whose measure is 6.5. The first row returns a multipoint containing two points. However, the second row returned an empty point. For linear features (geometry with a dimension greater than 0), LocateAlong can interpolate the point; however, for multipoints, the target measure must match exactly.

SELECT gid, CAST(db2gse.ST_AsText(db2gse.LocateAlong (g1,6.5)) AS
varchar(96)) "Geometry"
FROM LOCATEALONG_TEST
 
GID         Geometry
----------- --------------------------------------------------------------
 
          1 MULTIPOINT M ( 27.01000000 19.38000000 6.50000000, 27.40000000
22.14000000 6.50000000)
          2 POINT EMPTY
 
  2 record(s) selected. 

In the following SELECT statement and the corresponding result set, the LocateAlong function returns multipoints for both rows. The target measure of 7 matches the measures in both the multilinestring and multipoint source data.

SELECT gid,CAST(db2gse.ST_AsText(db2gse.LocateAlong (g1,7)) AS varchar(96)) "Geometry"
FROM LOCATEALONG_TEST
 
GID      Geometry
 
----------- --------------------------------------------------------------
          1 MULTIPOINT M ( 30.19000000 18.47000000 7.00000000, 30.98000000
 23.98000000 7.00000000)
          2 MULTIPOINT M ( 30.19000000 18.47000000 7.00000000, 30.98000000
 23.98000000 7.00000000)
 
  2 record(s) selected. 


[ Top of Page | Previous Page | Next Page ]