-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflowpyhelp.htm
More file actions
53 lines (45 loc) · 3.47 KB
/
flowpyhelp.htm
File metadata and controls
53 lines (45 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<b>FlowpyGIS!</b>
version 0.07 October 2009
<p>
This Python script "FlowpyGIS" replaces the functionality of the Flow Data Model Tools (FDMT). The following comments hopefully are sufficient to get it working. Compared to the FDMT, the script is faster, less error prone, and does not rely on ArcGIS to operate. However, the code does require Python 2.x and GDAL. Getting GDAL and Python installed and working together is discussed at <a href="http://gis.stackexchange.com/questions/9553/whats-the-easiest-way-to-install-gdal-and-ogr-for-python">GIS StackExchange</a>. Perhaps the easiest way to get the code rolling is to run it from the <a href="http://fwtools.maptools.org/">FWTools</a> shell.
<p>
FlowpyGIS is available on Github at: <a href="https://github.com/glennon/FlowpyGIS">https://github.com/glennon/FlowpyGIS</a>. The script uses an interaction matrix file and corresponding coordinate pair file, calculates gross, net, or two-way flow from them, and yields a shapefile. To run FlowpyGIS standalone, you'll need the two script files: "flowpyInterface.py" and "flowpyv07.py". You will also need two data files, a text file of point coordinates and a text file interaction matrix. Concerning the file specifications for the data files, the coordinate pair file should be one coordinate pair per line and the x y coordinates must be space delimited. The interaction file requires a square space delimited matrix of magnitude values. Each row refers to a "from" node; each column refers to a "to" node. In the following file examples, flow from row 3 (node 3: coordinates -75 40), column 11 (node 11: -96.75 32.75)coordinates possesses the value 10.
<p>
Example formatted coordinate pair data:<br>
--------------------------------------------------------------------------------------------------<br>
-71 42<br>
-74 41<br>
-75 40<br>
-81 41<br>
-77 37<br>
-84 33<br>
-88 42<br>
-90 39<br>
-93 45<br>
-94.5 39<br>
-96.75 32.75<br>
-122.5 37.75<br>
--------------------------------------------------------------------------------------------------<br>
<p>
Example corresponding formatted interaction matrix:<br>
--------------------------------------------------------------------------------------------------<br>
2040 289 47 52 137 118 90 10 16 15 13 80<br>
602 1980 231 209 388 307 286 15 48 26 18 261<br>
143 414 860 84 342 130 134 8 25 10 10 80<br>
68 192 47 1296 171 177 618 16 44 43 19 131<br>
150 266 158 226 3899 578 295 20 62 54 22 152<br>
122 159 57 186 319 3741 439 30 51 78 102 189<br>
97 155 39 496 143 266 5630 74 278 100 40 290<br>
31 56 14 142 80 201 573 342 46 128 47 109<br>
14 26 11 32 29 41 295 10 1438 51 14 138<br>
20 41 8 55 40 71 215 33 129 811 86 247<br>
31 41 8 38 46 165 125 20 37 253 788 203<br>
82 81 23 84 114 106 251 22 127 128 43 5380<br>
--------------------------------------------------------------------------------------------------<br>
<p>
<p>Some sample data, bankinteract.txt and bankpoints.txt can be found in the repo.</p>
To make FlowpyGIS work as a standalone script, edit FlowpyInterface.py to include your own variables and filenames as appropriate and then execute FlowpyInterface. The code is documented well enough to make pretty good guesses of the names to change. When the FlowpyInterface script runs, it passes the variables over to Flowpy07. Again, to get all the Python/GDAL bindings working right, I often just launch FlowpyGIS from a FWTools shell (<a href="http://fwtools.maptools.org/">http://fwtools.maptools.org/</a>)
<p>
Flow on!<br>
Alan Glennon<br>
UCSB Geography <br>