4

I have an Origin-Destination table like this

Origin Destination Value
A B 10
B A 100
A C 120
...

For all the locations A, B, C... I have another table indicating their location (Lat and Lon)

Is there any way to draw two separate lines between A and B so that I can visualize the directionality and distinguish the flow volume between these two places?

Thanks!

6
  • Some of the answers given to the related question at gis.stackexchange.com/questions/5204/… might naturally solve this because the arcs they draw are asymmetrical. Because that is somewhat of an accidental feature of these solutions, they ought to be considered work-arounds rather than primary answers to your question, but perhaps they might be helpful in some cases.
    – whuber
    Commented Feb 20, 2013 at 20:39
  • @whuber Thanks for your suggestions. I was thinking a way to solve this: 1) Define a function DrawArcBetween(Origin, Destination, arc) 2) Define a Hashset<Destination,Origin> 3) If the destination, origin pair can be found in the Hashset, take the negative of the arc. Don't know if there would be simpler way to solve this...
    – Seen
    Commented Feb 20, 2013 at 20:49
  • There are simpler ways. For instance, define an asymmetric arc-drawing function. (Mathematica does this by default for directed graphs, incidentally.) For example, to draw an arc from A to B, first jog a little to the left at A, head towards the left of B, then jog (towards the right) back to B at the end. That algorithm when applied from B to A will produce a different parallel arc between A and B. I have illustrated this in an answer at stats.stackexchange.com/questions/48467/….
    – whuber
    Commented Feb 20, 2013 at 21:01
  • Are you trying to do this in ArcGIS or R?
    – Andy
    Commented Feb 20, 2013 at 22:11
  • @Andy R should be fine for me.
    – Seen
    Commented Feb 20, 2013 at 22:25

2 Answers 2

2

FlowMapper Plugin for QGIS (v0.2.3) can exactly do what you want. Using a white space delineated interaction matrix (txt) and a set of coordinates (txt) you can create two way flow line segments.

e.g. Assuming that we have 3 nodes A, B, C

txt input coordinates file (long, lat)
40.789 30.987
40.123 30.456
39.678 29.741

txt interaction square matrix (From node -> To node)
0 200 300
50 0 150
10 20 0

http://plugins.qgis.org/plugins/FlowMapper/

1
  • Note that with three nodes, the O-D matrix would have six records, not three, because the order of the points matters here. I therefore have the same question for you as I had for RyanDalton: why wouldn't this just create two coincident features for each O-D pair? Is there some setting that can be changed to prevent that?
    – whuber
    Commented Jul 2, 2013 at 16:46
0

In ArcGIS, you can accomplish this by using the XY To Line tool to accomplish this task, with a little work.

You'll first need to create a new featureclass that has both the Origin & Destination Lat/Long, then you can use XY to Line tool to build the geodesic lines between them, using something similar to the code snippet on the help page:

arcpy.XYToLine_management(input_table,out_lines,
                         "LOND1","LATD1","LOND2",
                         "LATD2","GEODESIC","idnum")

You can also accomplish this by running the tool in ModelBuilder if you don't want to deal with Python.

3
  • Why wouldn't this just create two perfectly coincident features for each O-D pair?
    – whuber
    Commented Jul 2, 2013 at 16:13
  • yes, it does, actually, create coincident lines between the O-D pair. But it does create two lines, going in both directions. Commented Jul 2, 2013 at 16:37
  • I'm pretty sure the spirit of the question includes being able to "visualize ... and distinguish" between the two lines. Coincidence prohibits that.
    – whuber
    Commented Jul 2, 2013 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.