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!

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Seen
  • 2,205
  • 7
  • 26
  • 37
  • Some of the answers given to the related question at http://gis.stackexchange.com/questions/5204/curved-point-to-point-route-maps 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 Feb 20 '13 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 Feb 20 '13 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 http://stats.stackexchange.com/questions/48467/what-is-symmetric-property-for-stationary-distribution/48522#48522. – whuber Feb 20 '13 at 21:01
  • Are you trying to do this in ArcGIS or R? – Andy Feb 20 '13 at 22:11
  • @Andy R should be fine for me. – Seen Feb 20 '13 at 22:25
  • Do you need these points and lines in a GIS package? Or is this purely for visualisation? – om_henners Feb 20 '13 at 22:31

2 Answers2

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/

cempro
  • 644
  • 5
  • 11
  • 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 Jul 02 '13 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.

RyanKDalton
  • 23,068
  • 17
  • 110
  • 178
  • Why wouldn't this just create two perfectly coincident features for each O-D pair? – whuber Jul 02 '13 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. – RyanKDalton Jul 02 '13 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 Jul 02 '13 at 16:43