From: Regina Obe Date: Sat, 1 Aug 2009 18:33:18 +0000 (+0000) Subject: update ST_Line_Locate ... with example of closest point. Asked way too many times... X-Git-Tag: 1.5.0b1~569 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ed90a2fccd62cbcf022ed0f3d4a30345caef165;p=postgis update ST_Line_Locate ... with example of closest point. Asked way too many times on postgis news groups git-svn-id: http://svn.osgeo.org/postgis/trunk@4341 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference.xml b/doc/reference.xml index f484999ce..c6a750fe0 100644 --- a/doc/reference.xml +++ b/doc/reference.xml @@ -4746,13 +4746,13 @@ GROUP BY gid, field1,field2; This function supports 3d and will not drop the z-index. - + - - - - - This method supports Circular Strings and Curves + + + + + This method supports Circular Strings and Curves @@ -9877,7 +9877,7 @@ When densifyFrac is specified, this function performs a segment densification be -The current implementation supports only vertices as the discrete locations. This could be extended to allow an arbitrary density of points to be used. +The current implementation supports only vertices as the discrete locations. This could be extended to allow an arbitrary density of points to be used. @@ -9893,18 +9893,18 @@ The current implementation supports only vertices as the discrete locations. Thi Examples - postgis=# SELECT st_HausdorffDistance( - 'LINESTRING (0 0, 2 0)'::geometry, - 'MULTIPOINT (0 1, 1 0, 2 1)'::geometry); + postgis=# SELECT st_HausdorffDistance( + 'LINESTRING (0 0, 2 0)'::geometry, + 'MULTIPOINT (0 1, 1 0, 2 1)'::geometry); st_hausdorffdistance ---------------------- - 1 + 1 (1 row) postgis=# SELECT st_hausdorffdistance('LINESTRING (130 0, 0 0, 0 150)'::geometry, 'LINESTRING (10 10, 10 150, 130 10)'::geometry, 0.5); st_hausdorffdistance ---------------------- - 70 + 70 (1 row) @@ -13246,7 +13246,7 @@ MULTILINESTRING((3 4,4 5),(1 2,3 4)) - + Linear Referencing @@ -13311,6 +13311,14 @@ SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.5)) -------------------- 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) + @@ -13318,7 +13326,7 @@ SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.5)) See Also - , + ,,, @@ -13384,6 +13392,14 @@ WHERE ST_DWithin(street_line, house_loc, 0.2); POINT(1.01 2.06) | 10 POINT(2.02 3.09) | 15 POINT(3.03 4.12) | 20 + + --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) +