Ok, it took a incredible ridiculous amount of time to create it, but I finally did it!
CREATE NETWORK FLOW ARCS
The script is quite simple. It takes a shapefile with an ID, and origins and destinations coordinates in it and calculate from a given index, a curve between the origin and destinations. That’s it. It don’t do much, but it answered a need I had so…
HOW IT WORKS
The arguments on the command line must be: >;python FlowArcs.py [C:/Path/Shapefile.shp] [curvature index]
The source shapefile must be structured like that: id | FromX | FromY | ToX | ToY
The script use the values in the shapefile to create the arcs, not the geometry of the points. The order is important because it search for the position of the field, not its name.
The curvature index determine the “roundness” of the arcs created. With an index of 1 (there’s a mistake on the picture below), you will have a perfect half circle and the higher the index, the flatter the arcs will be. It depends of your data, but with our tests, an index of 10 is usually good.
The output will be in a “Arc” directory, in the same directory as your source shapefile.
For those interested in the “principle” behind it:
You’ll need GDAL-OGR and Shapely in order to make it works.
You can download the file here: FlowArcs.py
FlowArcs.py by François Goulet is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License