-- The locatebetween_test table is created with two columns: -- the gid integer column uniquely identifies each row, -- while the g1 ST_MultiLineString stores the sample geometry. CREATE TABLE locatebetween_test (gid integer, g1 ST_Geometry); -- The INSERT statements insert two rows into the locatebetween_test table. -- The first row is a ST_MultiLineString and the second is a ST_MultiPoint. INSERT INTO locatebetween_test VALUES( 1, 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))',1000) ); INSERT INTO locatebetween_test VALUES( 2, 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)', 1000) ); -- The SE_LocateBetween function below locates measures lying -- between measures 6.5 and 7.5, inclusively. The first row returns -- a ST_Multilinestring containing several LineStrings. The second -- row returns a ST_MultiPoint because the source data was ST_MultiPoint. -- When the source data has a dimension of 0 (point or multipoint) -- an exact match is required. SELECT gid, SE_LocateBetween(g1,6.5,7.5) Geometry FROM locatebetween_test;