![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1056830/image.png)
Graph with undirected edges from Shapefile
4 次查看(过去 30 天)
显示 更早的评论
I want to use two shapefiles containing:
- Streets as 'Lines', with x and y coordinates, streetnames, length, etc.
- Road Nodes as 'Points', with x and y coordinates, nodenames, ...
(Source: http://www.gis-rest.nrw.de/atomFeed/rest/atom/f4affc5e-a01a-4531-895c-5c6e59685ed1.html , AbschnitteAeste & Netzknoten)
How do I combine those shp Files an create a Graph with undirected edges?
I can load them both into Matlab and display them using mapshow():
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/514132/image.png)
Any help would be incredible!
1 个评论
Sim
2022-7-6
编辑:Sim
2022-7-6
A starting point
S1 = shaperead(('BKM_point.shp'));
S2 = shaperead(('ABSCHNITTEAESTE_line.shp'));
hold on
for i = 1 : size(S1,1)
plot(S1(i).X, S1(i).Y,'Color','k','Marker','o','MarkerSize',3)
end
for i = 1 : 2000 % I put "2000" instead of "size(S2,1)" since too large
plot(S2(i).X, S2(i).Y,'Color','b','Marker','o','MarkerSize',3)
end
hold off
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1056830/image.png)
Here,
S1.X
S1.Y
are the nodes coordinates for "BKM_point.shp", and
S2.X
S2.Y
are the nodes coordinates for "ABSCHNITTEAESTE_line.shp", but
where is the information about the edges ??
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!