<div dir="ltr">hi,<br><br>just a suggestion: you should try a check to identify the line segment that don't lies in the road.<br><br><span class="term">ST_PointN(geometry,integer) you can iterate and create the line segments.<br>
then you can run a ST_Contains to check if your road segment matches route segment.<br>you should save the information of the line segment after and before the ST_Contains fails.<br>with that information you can find the vertice and them interpolate to create him.<br>
<br>best regards,<br></span> <br>Luigi Castro Cardeles
<br><br><div class="gmail_quote">2008/7/18 searchelite <<a href="mailto:searchelite@gmail.com">searchelite@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c"><br>
<br>
searchelite wrote:<br>
><br>
><br>
><br>
> Obe, Regina     DND\MIS wrote:<br>
>><br>
>> Now you do your make line.  But you'll have to take into consideration<br>
>> what Paolo Rizzi said afterward.  Not sure the easiest way to do that.<br>
>><br>
>> So basically your process should look something like the below where<br>
>> trip_id is some fied that uniquely identifies each trip.  The below snaps<br>
>> each point to closest road segment and then makes a line for each trip.<br>
>> It assumes the pt.gid is in the order of time travel.  If you have a<br>
>> datetime field for each point, use that instead of the pt.gid.<br>
>><br>
>>  SELECT trip_id, ST_MakeLine(snapped_point) As trip_route<br>
>> (SELECT<br>
>> pt_id,<br>
>> ln_id,<br>
>><br>
>> ST_Line_Interpolate_Point(<br>
>>  ln_geom,<br>
>>  ST_Line_Locate_Point(ln_geom, pt_geom)<br>
>>  ) As snapped_point,<br>
>> travel_id<br>
>><br>
>> FROM<br>
>> (<br>
>> SELECT DISTINCT ON (pt.gid)<br>
>>  ln.the_geom AS ln_geom,<br>
>>  pt.the_geom AS pt_geom,<br>
>>  <a href="http://ln.id" target="_blank">ln.id</a> AS ln_id,<br>
>>  pt.gid AS pt_id,pt.trip_id<br>
>> FROM<br>
>> gps_points pt INNER JOIN<br>
>> road_table ln<br>
>> ON<br>
>> ST_DWithin(pt.the_geom, ln.the_geom, 10.0)<br>
>> ORDER BY<br>
>> pt.gid,ST_Distance(ln.the_geom, pt.the_geom)<br>
>> ) AS subquery ORDER BY trip_id, pt_id) As snapped_points<br>
>> GROUP BY travel_id;<br>
>><br>
>> Hope that helps,<br>
>> Regina<br>
>><br>
>><br>
><br>
><br>
> thanks a lot for the reply...i'll try the code you give me first thing<br>
> tomorrow...:-)<br>
><br>
><br>
<br>
</div></div>basically, the code you gave me just create a line from snapped points<br>
right? what about matching the route with the road? I want to make the route<br>
like the illustration below<br>
<br>
<a href="http://www.nabble.com/file/p18522213/untitled.jpg" target="_blank">http://www.nabble.com/file/p18522213/untitled.jpg</a><br>
<br>
<br>
thank you<br>
<font color="#888888"><br>
<br>
<br>
--<br>
View this message in context: <a href="http://www.nabble.com/match-line-with-road-segment-tp18479996p18522213.html" target="_blank">http://www.nabble.com/match-line-with-road-segment-tp18479996p18522213.html</a><br>
</font><div><div></div><div class="Wj3C7c">Sent from the PostGIS - User mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div>