[postgis-users] match line with road segment

Paragon Corporation lr at pcorp.us
Mon Jul 21 03:50:53 PDT 2008

Are you just looking to get back the portions of the line segments with the
line segment id of the line segments that intersect your road.

If so, then now that you have your single line, you can splice it with the
road segments by doing

SELECT r.gid As road_gid, t.tripid, ST_Intersection(r.the_geom,
triproute.the_geom) As road_segment
 FROM roads r INNER JOIN triproute t ON ST_Intersects(r.the_geom,

The only problem with the above is that it will splice your trip into the
various road segments making it up, but then you loose the time path that
make line gave you.  
It may not matter depending on what you are doing though.

If you want to still maintain a sense of time and splice such that you have
something like

Timestart, trip_id, trip_road_segment, road_gid

Then that's a tad bit trickier and requires you do this after you do the
snap points.

Hope that helps,

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Sent: Monday, July 21, 2008 4:56 AM
To: postgis-users at postgis.refractions.net
Subject: Re: [postgis-users] match line with road segment

Luigi Castro Cardeles wrote:
> hi,
> just a suggestion: you should try a check to identify the line segment 
> that don't lies in the road.
> ST_PointN(geometry,integer) you can iterate and create the line segments.
> then you can run a ST_Contains to check if your road segment matches 
> route segment.
> you should save the information of the line segment after and before 
> the ST_Contains fails.
> with that information you can find the vertice and them interpolate to 
> create him.
> best regards,
> Luigi Castro Cardeles

thanks for the suggestion, but there is a problem...I'm using ST_makeline to
create the route so it only return 1 linestring. When i check with
ST_contains(road_segment, route) it returns f values for all the record 

View this message in context:
Sent from the PostGIS - User mailing list archive at Nabble.com.

postgis-users mailing list
postgis-users at postgis.refractions.net

More information about the postgis-users mailing list