OpenStreetMap data - one-ways and two-ways

79 views
Skip to first unread message

subhrajit.debnath

unread,
Jul 11, 2013, 5:18:37 AM7/11/13
to gama-p...@googlegroups.com
Hi all,

I have extracted OSM road network in which roads can be unidirectional or bidirectional. I want my vehicle agents to move in both directions on certain roads which are tagged 2-ways.
How can I handle bidirectional road in a graph in GAMA?  Please suggest..

Patrick Taillandier

unread,
Jul 11, 2013, 1:40:14 PM7/11/13
to gama-p...@googlegroups.com
Hi,

From my point of view, the simplest way is to define a directed graph, and to duplicate road agents in case of bidirectional road.
If you want, I can send you a simple road network model with both unidirectional and bidirectional roads for the end of the week.

Cheers,

Patrick



2013/7/11 subhrajit.debnath <subhraji...@gmail.com>
Hi all,

I have extracted OSM road network in which roads can be unidirectional or bidirectional. I want my vehicle agents to move in both directions on certain roads which are tagged 2-ways.
How can I handle bidirectional road in a graph in GAMA?  Please suggest..


--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

subhrajit.debnath

unread,
Jul 12, 2013, 4:33:02 AM7/12/13
to gama-p...@googlegroups.com

Ya It would be very helpful if you can send the model.
Thank you.

Srirama Bhamidipati

unread,
Jul 12, 2013, 8:29:04 AM7/12/13
to gama-p...@googlegroups.com
Yes, I would also like a copy.

Kind regards,
Srirama

Patrick Taillandier

unread,
Jul 13, 2013, 8:16:57 AM7/13/13
to gama-p...@googlegroups.com
Hi,

I finished to implement a simple model that takes into account bidirectional/unidirectional roads. However, I had to correct a small bug in GAMA (I committed the patch few minutes ago), thus this model will not works (well) with an oldest version of GAMA (1.5.1 or old 1.6).

Cheers,

Patrick


2013/7/12 Srirama Bhamidipati <b.sr...@gmail.com>
road_directed_undirected.zip

Srirama Bhamidipati

unread,
Jan 10, 2014, 1:16:17 AM1/10/14
to gama-p...@googlegroups.com
Hi,

I refer to this code below;

1. if a link is bidirectional: this is already how the gama model works by default to allow movement in both directions. Is it no ? If yes, then why does the code have to create again 2 roads of opposite direction ?

2. if a link is one way: it is important to know in which direction is it one way. I do not understand why the code below reverses the direction of a road ? how does it know the 'real' world direction ? Is it standard that in OSM the oneway is always marked in the opposite direction of the digitized direction. 

3. what about using this code with a shapefile, we then have to be careful with real world directions?

Please could you explain on these.

regards,
Sriramaa

-----------------\\\\\\\--------------------------------
init {
create road from: road_file with:[direction::int(read("DIRECTION"))] {
switch direction {
match 0 {color <- rgb("green");}
match 1 {color <- rgb("red");
//inversion of the road geometry
shape <- polyline(reverse(shape.points));
}
match 2 {color <- rgb("blue");
//bidirectional: creation of the inverse road
create road {
shape <- polyline(reverse(myself.shape.points));
direction <- 2;
color <- rgb("blue");
}
}
}
-----------------\\\\\\\--------------------------------

Patrick Taillandier

unread,
Jan 10, 2014, 4:11:14 AM1/10/14
to gama-p...@googlegroups.com
Hi,

First of all, I am not sure to know from where your code is extracted, however, I will try to answer your question.

1. if a link is bidirectional: this is already how the gama model works by default to allow movement in both directions. Is it no ? If yes, then why does the code have to create again 2 roads of opposite direction ?

The operator as_edge_graph that is very often used in GAMA builds a bidirectional graph. However, the new operator as_driving_graph builds a directional graph (the geometry of the line is used to define the direction of the link).

2. if a link is one way: it is important to know in which direction is it one way. I do not understand why the code below reverses the direction of a road ? how does it know the 'real' world direction ? Is it standard that in OSM the oneway is always marked in the opposite direction of the digitized direction. 
I always considered the direction of the link is the the one of the line geometry. So, if you load data from a shapefile or an OSM file, it will be by default the digitized direction. In the code example that you showed, we consider that an attribute DIRECTION is defined: if this one is equal to 0, the link has for direction the digitized one; if DIRECTION is equal to 1, the link has for direction the inverse of the digitized one; if DIRECTION is equal to 0, the link is bidirectional (so I build a second line that has for geometry the reverse of the line geometry).
Note that I do not think that there is a standard for the road direction, this example is just an illustration of what can be done to build a directional graph.

3. what about using this code with a shapefile, we then have to be careful with real world directions?
Yes, you have to be sure that the digitized direction correspond to the real world direction, or at least to have an attribute like DIRECTION that allows to know the real world direction of each line.

Cheers,

Patrick



2014/1/10 Srirama Bhamidipati <b.sr...@gmail.com>

Srirama Bhamidipati

unread,
Jan 10, 2014, 4:52:52 AM1/10/14
to
Hmm, 

Interesting clarification. I will read your comments carefully. I have had numerous experiences where digitization does not correspond to the direction of real world travel (direction), so I would still be cautious.

the code is yours from the message before mine.

thanks

regards,
Srirama
Reply all
Reply to author
Forward
0 new messages