How to convert a graph / edges list into a shapefile (.shp) ?
15 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Christine Tobler
2022-7-6
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).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Directed Graphs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!