[GraphHopper] How to consider traffic jam when route on road network
Peter K
peathal at yahoo.de
Mon Jan 6 12:22:38 UTC 2014
Hi,
indeed: if you are updating the edges in real time you won't be able to
use CH or you will have to prepare the graph again which is not
real-time but okayish for country-sized data like Germany (<10min) and
good for even big cities (<2min). Updating the already contracted graph
is possible but complex and tedious.
If you maintain some mapping between OSM IDs (or GPS data) and the
GraphHopper edge IDs this "update" process is easily implemented (and
should be very fast) if you overwrite the Weighting (no changes
necessary to the FlagEncoder I think) and return your own:
@Override
public double calcWeight( EdgeIteratorState edge ) {
return getWeightForID(edge.getEdge());
}
> Even when you know the Edge Id, you have to iterate over all Edges.
As Nicolas pointed out there is the getEdgeProps method, but I think
extending "Weighting" should be sufficient.
> how to set this bitmask because I couldn't find any documentation on
to flags itself.
Yes, again as Nicolas said (thanks btw :) !) there is no documentation
but you can see the CarFlagEncoder class and its unit tests. Mainly the
first two bits specifies the access (forward?, backward?) and then the
speed as integer (but with low resolution - only 5km/h). You should
increase the resolution if you have very precise real time data.
Regards,
Peter.
> Hello,
>
>
>
> It could work but I think that this will get the routing algorithm
> even slower.
>
> Add this to the drop of contraction your performances would get really
> poor I'm afraid.
>
>
>
> Nicolas GILLET
>
>
>
> * *
>
> *Market-IP --*///Creating Mobile Intelligence/
>
> Phone : +32 81 33 11 11
>
> Fax : +32 81 33 11 10
>
> www.market-ip.com <http://www.market-ip.com/> -- www.telefleet.com
> <http://www.telefleet.com/> -- www.geoplanning.net
> <http://www.geoplanning.net/> -- www.drivexpert.net
> <http://www.drivexpert.net/>
>
> Description : cid:image003.png at 01CD5521.849F3340
> <http://www.linkedin.com/groups/MarketIP-4289716?gid=4289716&trk=hb_side_g>
>
>
>
> *De :*lanmaster at hotmail.ru [mailto:lanmaster at hotmail.ru]
> *Envoyé :* lundi 6 janvier 2014 12:17
> *À :* Nicolas Gillet
> *Cc :* GraphHopper Java routing engine; Jrgen Zornig
> *Objet :* Re: Re: [GraphHopper] How to consider traffic jam when
> route on road network
>
>
>
> Hello, Nicolas,
>
> Why do I need to change any edge's weight?
> My thought is about make no change in the graph data, but parallel
> calculate my own weights and use that in algorithm-place, where gets
> original Graph's weights.
> May be my things was incorrect, please explain me.
>
> ??? 06 ??? 2014 16:05:06 +0500, Nicolas Gillet
> <nicolas.gillet at market-ip.com <mailto:nicolas.gillet at market-ip.com>>
> ???????:
>
> Hello guys,
>
>
>
> That implementation won't be efficient I think.
>
> First thing you must know about using real time weighting is that you
> won't be able to use contractions hierarchies unless you re-contract
> the whole graph any time you change any edge's weight.
>
> Without contraction you'll have a serious downgrade of performances.
>
>
>
> If you still want to perform real time weighting, the best option is
> to update the edge's weight with your live traffic info, so updating
> the flags.
>
>
>
> > 1.) Which flags are included and which position they are set?
> This depends on the flag encoders you use, check the CarFlagEncoder class.
>
>
>
> > 2.) Is there a convinient way to get a single EdgeIteratorState Object directly by poviding its ID?
>
> If you know it's GraphHopper's ID, you can do
> graph.getEdgeProps(edgeId, Integer.MIN_VALUE) but you'll have to
> maintain a way to link OSM ID's with GH's ids.
>
>
>
> Regards,
>
>
>
> Nicolas GILLET
>
>
>
> * *
>
> *Market-IP --*///Creating Mobile Intelligence/
>
> Phone : +32 81 33 11 11
>
> Fax : +32 81 33 11 10
>
> www.market-ip.com <http://www.market-ip.com/> -- www.telefleet.com
> <http://www.telefleet.com/> -- www.geoplanning.net
> <http://www.geoplanning.net/> -- www.drivexpert.net
> <http://www.drivexpert.net/>
>
> Description : cid:image003.png at 01CD5521.849F3340
> <http://www.linkedin.com/groups/MarketIP-4289716?gid=4289716&trk=hb_side_g>
>
>
>
> *De :*lanmaster at hotmail.ru <mailto:lanmaster at hotmail.ru>
> [mailto:lanmaster at hotmail.ru]
> *Envoyé :* lundi 6 janvier 2014 11:47
> *À :* Jrgen Zornig
> *Cc :* GraphHopper Java routing engine
> *Objet :* Re: [GraphHopper] How to consider traffic jam when route
> on road network?
>
>
>
> Hello, Jrgen!
>
> I think about this implementation:
> 1. We have in-memory arraylist, that contains infos about traffic jam
> 2. We have function that can calculate weight of way by two coordinate
> pairs (from node / to node)
> 3. We have modification on Graphhopper's route calculate algorithm,
> that can request weight from our weight function (2) and summarize it
> with original Graphhopper's weight.
>
> Can that implementation be useful, how do you think?
>
>
> ??? 06 ??? 2014 15:16:52 +0500, Jrgen Zornig <juergen.zornig at gmail.com
> </compose/?adb_to=juergen.zornig at gmail.com>> ???????:
>
> I am also trying to figure out how real time graph modifications and
> short and temporary events should be handled for the routing.
>
> I assume you use to OSM graph? That makes things more complicated I
> think,because I have not found a function to retrieve a single Edge
> without iterating over and over the whole graph. Even when you know
> the Edge Id, you have to iterate over all Edges.
>
> In our scenario, we use a different (our own) graph, and while loading
> it, I build up a HashMap for all EdgeIteratorState Objects I have
> generated during loading. So I can easily find a corresponding Edge
> for a given TrafficJam, either by directly referencing it over our
> EdgeIds or by finding out the Id via the LocationIndex (NodeIds and
> the referenced EdgeIds).
>
> When having the corresponding EdgeIteratorState Object it should be
> simple to deactivate the Edge by calling setFlags(), but I also have
> no clue yet, how to set this bitmask because I couldn't find any
> documentation on to flags itself.
>
> So I want to add to this question:
>
> 1.) Which flags are included and which position they are set?
> 2.) Is there a convinient way to get a single EdgeIteratorState Object
> directly by poviding its ID?
>
> I am in need of these functions to handle real time traffic data on
> the graph.
>
> P.S. Perhaps we can figure it out by ourselves, so Peter doesn't have
> to answer every single question ;)
>
> Regards,
>
> Juergen
>
> Am 06.01.2014 09:54, schrieb lanmaster at hotmail.ru
> </compose/?adb_to=lanmaster at hotmail.ru>:
>
> Graphhopper is a project for finding routes over a road network.
> It also provides functionality for weighting this routing like
> |fastest| or |shortest| path e.g. via the FastestWeighting class.
> Now, the question is: how can we extend |Graphhopper| to use the
> speed data we get from our traffic provider in realtime?
>
> As I can see:
>
> 1. We must create a function that gets traffic jam data from our
> database.
> 2. We must force use that modified function (Encoder?) somewhere
> in Graphhopper |route()| function. Do I think right?
>
> Please show me how we can do this by example.
>
>
>
> _______________________________________________
>
> GraphHopper mailing list
>
> GraphHopper at openstreetmap.org <mailto:GraphHopper at openstreetmap.org>
>
> https://lists.openstreetmap.org/listinfo/graphhopper
>
>
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140106/3b9f2b67/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 1263 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140106/3b9f2b67/attachment.png>
More information about the GraphHopper
mailing list