[postgis-users] How to get the nearest point for a given point from a geometry of multilinestring

Thilani thilanii at gmail.com
Sat Aug 1 00:04:45 PDT 2009


Hi kevin

As you suggested, I tried to find the closest points but it did not worked
for me. May be I need more help from you. This is what I tried,

e.g. 
select ST_line_locate_point(ST_geomFromText('LINESTRING(0 0, 1 1, 2 2, 3 3,
49 49, 51 51, 100 100)'), ST_GeomFromText('POINT(50 50)'))

What I want is to get points 49, 49 and 51, 51 or the percentage of those as
the result. But this returned 0.5 as the result.Can you please help me to
get 49,49 and 51,51 as the result.Can you please explain that by using your
own example.Please feel free to modify above example.

Thanks and Best Regards,
Thilani


Thilani wrote:
> 
> Thanks a lot.I will try with this and let you know the result.
> Thilani
> 
> On Tue, Jul 21, 2009 at 10:43 AM, Kevin Neufeld<kneufeld at refractions.net>
> wrote:
>> If I understand you correctly, you could first find the 2-point line
>> segment
>> within your multilinestring that is within some tolerable distance to
>> your
>> intersection point.  The endpoints of the linesegment would be vertices
>> closest to your intersection point.
>>
>> Here's an old way of extracting the line segments from a linestring if it
>> helps.
>> http://postgis.refractions.net/pipermail/postgis-users/2008-March/018734.html
>>
>> Or, use ST_Line_Locate_Point
>> (http://www.postgis.org/documentation/manual-svn/ST_Line_Locate_Point.html)
>> to determine the percentage along your linestring the intersection point
>> occurs.  Then for every vertex determine their percentage along to find
>> the
>> two vertices of interest.
>>
>> -- Cheers,
>> Kevin
>>
>>
>> Thilani Imalka wrote:
>>>
>>> We used ST_Intersection function to get the cross point when roads are
>>> crossing each other. So with the output of this function we have the
>>> crossing point and now we need to get adjacent points to that crossing
>>> point from the road (where the road is a geometry of
>>> multilinestring).Is there any post GIS function to get those adjacent
>>> points or any combination of functions to get the correct output
>>> Basically we need to get the nearest point for a given point from a
>>> geometry of multilinestring.
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-get-the-nearest-point-for-a-given-point-from-a-geometry-of-multilinestring-tp24569069p24766661.html
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list