I am looking to store a model of a network in a txt file. I am not looking for the most efficient way, but rather, something that any program can read, as is relatively easy to setup. I dont want to be using any form of database.
I have a small simplified river network, and i have points (x,y), and certain points are connected to others, and both the points store an attribute, as does the lines between them.
Im not sure if it would be a good approach to have everything in one text file, so that for example each line in the txt has:
- unique ID # for a point
- x and y coordinate to define point
- which other points this point is it networked to ( can be 1,2,3 or 4)
- attribute of the point (elevation)
where i am sort of scratching my head is how to store attributes for the lines between points (the attribute being true/false, friction factor and length). I think it would probably be easiest to have this in a separate txt file and have some sort of algorythym to setup a simple relationship between the two? There is probably a tried and tested method of solving a problem like this, but this is my first time attempting a spatial problem that is not in a grid format.
Ultimately i would like to have a program (i will be using python) where i place a pollutant in the water at a given x,y coordinate, then have it flow progressively in the river network, and visually represent this by having lines change color as this is happening (as the state of the line goes from false to true, as in it is true that this part of the river is now contaminated).
So what is the best way of setting this up? starting with a) any standard ways to draw the network, then b) to track how something can spread through it?
For example sake, here is something i have to work with, #=are comments, i did not include attributes here for simplicity sake and includes a few mini quesitons
UID x y connectedTo
1 1,1 2 #coordinate 1 has unique identifier "1", has
#coordinates at (1,1) and is linked to coordinate 2
2 2,2 1,3,6 #dont know if its good to repeat here (that 2 is connect to 1, because this
#is already known to the program on the first line
3 3,4 2,4
4 4,4 3,5
5 4,5 4 #this is an end point of the network (ocean), should i be aware of any
#special/tricky treatments of and end point to a network?
6 4,2 2,7,8
7 3,1 6 #end point
8 5,1 6 #end point
thank you!
Start Free Trial