[postgis-users] Create new lines from GPS points

Stephen Woodbridge woodbri at swoodbridge.com
Thu Jan 13 07:30:59 PST 2011


Martin,

You just have to break the problem down into smaller tasks like:

1. project the point onto the closest road segment
2. if I have a previous point that I already projected
3. if that point is on the same segment as this point
4. extract the sub-segment from previous point to this point
5. if the two point are not on the same segment
6. see if the two segments are connected by comparing end points
7. if connected, the extract the segment from previous to connected end 
and connected end to current point
8. if they are not connected then route from previous point to current 
point and then extract those segments

I will leave how to route up to you for now. You can look at pgrouting 
or doing BFS of connected segments until you find the segment your 
current point is on.

Look in the postgis reference for the linear referencing functions fo 
how to project a point onto a segment and how to extract a portion of a 
segment.

-Steve
  http://imaptools.com/

On 1/13/2011 9:50 AM, Martin Fafard wrote:
> Hi
>
> Last step for my problem. Following the attached jpg, I need to
> highlight (create new line) the topological road (black) only when it
> intersect the green line
> Any advice?
> Thank you
>
> Martin
>
> Stephen Woodbridge a écrit :
>> I think this problem has some hidden assumptions about what is the
>> rate of the incoming points, or more appropriately how close together
>> the GPS points are and with mis-alignment of GPS with respect to high
>> density road networks. If the GPS sample rate is high and the relative
>> distance is small percentage of the road network segments then the
>> problem is easier to solve because you can assume that any given point
>> is likely on the same segment as the last point or just transitioned
>> to the next segment in the network.
>>
>> There are still serious issue if there is a mis-alignment between the
>> GPS data and the road segments, especially in dense road network
>> areas. Here you might need to apply a stickiness to the segment you
>> are one and do additional analysis and in fact defer judgment to N-1
>> when looking at point N.
>>
>> Also as your sample rate spreads out and the distance between GPS
>> point increases then the last segment and the current segment might
>> not even be touching so you might need to route between the adjacent
>> GPS points. Add to this mis-alignment issues and you have a very
>> tricky problem to solve.
>>
>> The above issues are particularly prevalent in CDMA cell phone tower
>> assisted GPS systems that can have a lot of error in urban areas which
>> also have higher density road networks, but need to be considered with
>> any system like this.
>>
>> -Steve W
>>
>> On 1/11/2011 12:15 PM, Ralf Suhr wrote:
>>> This will work. The GPS point is never on the road geometry.
>>>
>>> ST_Line_Substring( road,
>>>
>>> ST_Line_Locate_Point(road, ST_ClosestPoint(gps_start, road)),
>>>
>>> ST_Line_Locate_Point(road, ST_ClosestPoint(gps_end, road))
>>>
>>> ) AS highlight
>>>
>>> Gr
>>>
>>> Ralf
>>>
>>> Am Dienstag 11 Januar 2011, 18:08:29 schrieb Ralf Suhr:
>>>
>>> > Hi Martin.
>>>
>>> >
>>>
>>> > ST_Line_Substring(road, ST_Line_Locate_Point(road, gps_start),
>>>
>>> > ST_Line_Locate_Point(road, gps_end)) AS highlight
>>>
>>> >
>>>
>>> > Gr
>>>
>>> > Ralf
>>>
>>> >
>>>
>>> > Am Dienstag 11 Januar 2011, 17:46:06 schrieb Martin Fafard:
>>>
>>> > > Ralf
>>>
>>> > >
>>>
>>> > > Yes, ok for the buffer. But how to "dynamically segment" my new road
>>>
>>> > > from my original segment?
>>>
>>> > >
>>>
>>> > > Martin
>>>
>>> > >
>>>
>>> > > Ralf Suhr a écrit :
>>>
>>> > > > Hi Martin,
>>>
>>> > > >
>>>
>>> > > > you will not get a correct solution for this problem. Your road
>>> network
>>>
>>> > > > and the gps points differs always.
>>>
>>> > > >
>>>
>>> > > > A possible "solution" is building a buffer around the streets und
>>> look
>>>
>>> > > > für intersection with gps points and filter by direction
>>> road/points.
>>>
>>> > > > Grouping gps points can give you the start and end point for the
>>> road.
>>>
>>> > > > If a road is only one times driven.
>>>
>>> > > >
>>>
>>> > > > Gr
>>>
>>> > > > Ralf
>>>
>>> > > >
>>>
>>> > > > Am Dienstag 11 Januar 2011, 17:16:18 schrieb Martin Fafard:
>>>
>>> > > >> Hi
>>>
>>> > > >>
>>>
>>> > > >> I have a network of roads (topological) and I receive GPS
>>> points. I
>>>
>>> > > >> would like to create new lines who follow exactly the same path
>>> as my
>>>
>>> > > >> road from the GPS points (to "highlight" where the GPS unit was
>>> on the
>>>
>>> > > >> network). The problem is I need to segment the new line
>>> because the
>>>
>>> > > >> GPS points can stop anywhere on my roads... Any advice to do
>>> this?
>>>
>>> > > >> Thank you
>>>
>>> > > >>
>>>
>>> > > >> Martin F
>>>
>>> > > >> _______________________________________________
>>>
>>> > > >> 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
>>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list