]> git.openstreetmap.org Git - nominatim.git/blob - sql/postgis_15_aux.sql
548e0fe552ab3de45b901c6ac6af0da81c29c1a1
[nominatim.git] / sql / postgis_15_aux.sql
1 -- Splits the line at the given point and returns the two parts
2 -- in a multilinestring.
3 CREATE OR REPLACE FUNCTION split_line_on_node(line GEOMETRY, point GEOMETRY)
4 RETURNS GEOMETRY
5   AS $$
6 DECLARE
7   frac FLOAT;
8 BEGIN
9   frac := ST_Line_Locate_Point(line, point);
10   RETURN ST_Collect(ST_Line_Substring(line, 0, frac),
11          ST_Line_Substring(line, frac, 1));
12 END
13 $$
14 LANGUAGE plpgsql;