123456789101112131415161718192021222324252627 |
- CREATE TABLE linestring_test (line ST_LineString);
- -- Create a U-shaped linestring:
- INSERT INTO linestring_test VALUES (
- ST_LineFromText('linestring z (0 10 1, 0 0 3, 10 0 5, 10 10 7)', 0)
- );
- -- Perpendicular point is coincident with the input point,
- -- on the base of the U:
- SELECT SE_PerpendicularPoint(line, ST_PointFromText('point(5 0)', 0))
- FROM linestring_test;
- -- Perpendicular points are located on all three segments of the U:
- SELECT SE_PerpendicularPoint(line, ST_PointFromText('point(5 5)', 0))
- FROM linestring_test;
- -- Perpendicular points are located at the endpoints of the U:
- SELECT SE_PerpendicularPoint(line, ST_PointFromText('point(5 10)', 0))
- FROM linestring_test;
- -- Perpendicular point is on the base of the U:
- SELECT SE_PerpendicularPoint(line, ST_PointFromText('point(5 15)', 0))
- FROM linestring_test;
- -- No perpendicular point can be constructed:
- SELECT SE_PerpendicularPoint(line, ST_PointFromText('point(15 15)', 0))
- FROM linestring_test;
|