0% found this document useful (0 votes)
15 views

7.10 Linear Referencing: See Also

This document summarizes the PostGIS ST_Line_Interpolate_Point function, which returns a point interpolated along a line geometry at a specified fraction of the line's total length. It takes a linestring geometry and a float between 0 and 1 as arguments, returning an interpolated point. Examples show interpolating points at 20% and 50% of line lengths, and finding the closest point on a line to another geometry.

Uploaded by

Mathias Eder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

7.10 Linear Referencing: See Also

This document summarizes the PostGIS ST_Line_Interpolate_Point function, which returns a point interpolated along a line geometry at a specified fraction of the line's total length. It takes a linestring geometry and a float between 0 and 1 as arguments, returning an interpolated point. Examples show interpolating points at 20% and 50% of line lengths, and finding the closest point on a line to another geometry.

Uploaded by

Mathias Eder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PostGIS 1.5.

1 Manual
243 / 315

UNION ALL
SELECT ST_GeomFromEWKT(LINESTRING(5 5 5, 10 10 10)) as the_geom ) as foo;
st_asewkt
--------GEOMETRYCOLLECTION(POINT(-2 3 1),LINESTRING(5 5 5,10 10 10),POLYGON((-7 4.2 2,-7.1 4.2
3,-7.1 4.3 2,-7 4.2 2)))

--Examples using new Array construct


SELECT ST_Union(ARRAY(SELECT the_geom FROM sometable));
SELECT ST_AsText(ST_Union(ARRAY[ST_GeomFromText(LINESTRING(1 2, 3 4)),
ST_GeomFromText(LINESTRING(3 4, 4 5))])) As wktunion;
--wktunion--MULTILINESTRING((3 4,4 5),(1 2,3 4))

See Also
ST_Collect

7.10 Linear Referencing


7.10.1 ST_Line_Interpolate_Point
Name
ST_Line_Interpolate_Point Returns a point interpolated along a line. Second argument is a float8 between 0 and 1 representing
fraction of total length of linestring the point has to be located.

Synopsis
geometry ST_Line_Interpolate_Point(geometry a_linestring, float a_fraction);

Description
Returns a point interpolated along a line. First argument must be a LINESTRING. Second argument is a float8 between 0 and 1
representing fraction of total linestring length the point has to be located.
See ST_Line_Locate_Point for computing the line location nearest to a Point.

Note
Since release 1.1.1 this function also interpolates M and Z values (when present), while prior releases set them to 0.0.

Availability: 0.8.2, Z and M supported added in 1.1.1


This function supports 3d and will not drop the z-index.

PostGIS 1.5.1 Manual


244 / 315

Examples

A linestring with the interpolated point at 20% position (0.20)


--Return point 20% along 2d line
SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.20))
FROM (SELECT ST_GeomFromEWKT(LINESTRING(25 50, 100 125, 150 190)) as the_line) As foo;
st_asewkt
---------------POINT(51.5974135047432 76.5974135047432)

--Return point mid-way of 3d line


SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.5))
FROM (SELECT ST_GeomFromEWKT(LINESTRING(1 2 3, 4 5 6, 6 7 8)) as the_line) As foo;
st_asewkt
-------------------POINT(3.5 4.5 5.5)

--find closest point on a line to a point or other geometry


SELECT ST_AsText(ST_Line_Interpolate_Point(foo.the_line, ST_Line_Locate_Point(foo.the_line , ST_GeomFromText(POINT(4 3)))))
FROM (SELECT ST_GeomFromText(LINESTRING(1 2, 4 5, 6 7)) As the_line) As foo;
st_astext
---------------POINT(3 4)

See Also
ST_AsText,ST_AsEWKT,ST_Length, ST_Line_Locate_Point

You might also like