se_locatealong.sql 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. -- The locatealong_test table is created with two columns:
  2. -- the gid column uniquely identifies each row,
  3. -- and the g1 ST_Geometry column stores sample geometry.
  4. CREATE TABLE locatealong_test (gid integer,
  5. g1 ST_Geometry);
  6. -- The INSERT statements insert two rows. The first is
  7. -- a multilinestring, while the second is a multipoint.
  8. INSERT INTO locatealong_test VALUES(
  9. 1,
  10. 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)
  11. );
  12. INSERT INTO locatealong_test VALUES(
  13. 2,
  14. 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)
  15. );
  16. -- In this query the SE_LocateAlong function finds points whose
  17. -- measure is 6.5. The first row returns a ST_MultiPoint containing two
  18. -- points. However, the second row returns an empty point.
  19. -- For linear features (geometry with a dimension greater than 0),
  20. -- SE_LocateAlong can interpolate the point, but for multipoints
  21. -- the target measure must match exactly.
  22. SELECT gid, SE_locatealong(g1,6.5) Geometry
  23. FROM locatealong_test;
  24. -- In this query the SE_LocateAlong function returns a ST_MultiPoint
  25. -- for both rows. The target measure of 7 matches measures in both
  26. -- the ST_MultiLineString and ST_MultiPoint source data.
  27. SELECT gid, SE_locatealong(g1,7) Geometry
  28. FROM locatealong_test;