How to convert a graph / edges list into a shapefile (.shp) ?
15 views (last 30 days)
Show older comments
Here an example of graph "G", built up with Matlab:
s = [1 1 2 2 2 3 3 3];
t = [2 3 3 4 5 6 7 5];
x = [0 0 1 0 4 3 1];
y = [0 1 0 4 5 0 -1];
G = graph(s,t);
G.Nodes.X = x'; G.Nodes.Y = y';
plot(G,'XData',G.Nodes.X,'YData',G.Nodes.Y)
0 Comments
Answers (2)
Christine Tobler
on 6 Jul 2022
There isn't a direct way to do this with a graph object. The mapping toolbox has a shapewrite function which produces a .shp file, but it will first require putting these vectors into one of its data structures (geolineshape or maplineshape might be the right ones for your case).
See Also
Categories
Find more on Directed Graphs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!