Hi Everyone,
Is there a function to identify subnets for every object in a vector file?
Consider there is a vector file and object1 is connected to Object 2 and 3 and object 3 is connected to Object 4. Is there a function that could generate the sub-networks for object 1,2,3, and 4 for example in a table form?
Object ID, Connected Object
1 1
1 2
1 3
1 4
2 2
3 3
3 4
is it possible to pass a vector file in shape format and generate such table in SQLite or be able to color the subnets in GRASS?
Thanks for your help,
Mehrdad
ᐧ
On 29/04/19 15:30, Mehrdad Varedi wrote:
Hi Everyone,
Is there a function to identify subnets for every object in a vector file?
Consider there is a vector file and object1 is connected to Object 2 and 3 and object 3 is connected to Object 4. Is there a function that could generate the sub-networks for object 1,2,3, and 4 for example in a table form?
Object ID, Connected Object
1 1
1 2
1 3
1 4
2 2
3 3
3 4
is it possible to pass a vector file in shape format and generate such table in SQLite or be able to color the subnets in GRASS?
What does "is connected to" mean in your case ? Is it one arc (with one category value) between each connected pair ? Or are the objects somewhere on a complex network and you just want to know if you can move from one to the other ?
If you have direct (one-arc) connections between each object pair, then you could just assign a cost of 1 to each arc, use v.net.allpairs to calculate the total cost (e.g. here the number of arcs) between objects and then extract only those where the total cost is equal to one.
Here's an example with the roadsmajor map in the NC demo data, considering all nodes between arcs as objects:
g.copy vect=roadsmajor,roads
v.db.addcolumn roads_nodes col="cost int"
v.db.update roads col=cost value=1
v.net -c roads out=roads_nodes op=nodes
v.net.allpairs roads_nodes out=roads_pairs arc_column=cost
v.db.select roads_pairs col=from_cat,to_cat where=cost=1
Moritz