Creating a map with nodes from existing map

조회 수: 10 (최근 30일)
Sam Quick
Sam Quick 2021년 5월 30일
답변: Steven Lord 2021년 5월 30일
I have a big map of several walking routes in a big public area, looking like this.
I would like to create some sort of custom map from this so every route is mapped onto a graph on which i can perform a dijkstra algorithm. To do this every intersection should become a node and every road should be mapped to a line in the graph. It should look something like this :
So the 1,2,3,4,5,6,... should all be nodes and the black lines represent the connections between the nodes.
Can anyone recommend a way to do this in matlab, so i can perform the dijkstra algorithm on it ? Is there a way I can draw it, or use gpx data to do so? It would be fine if I can do it on a really simplified graph of the routes, I just need something to work with that ressembles the routes of the area.
  댓글 수: 1
Sam Quick
Sam Quick 2021년 5월 30일
Side note: I also have gpx files of every route, and tried to combine it to one big gpx file of all the routes but i didn't find a way to perform the Dijkstra algorithm on it. If you know a way to do it with the gpx data, that would also be great.

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
Steven Lord 2021년 5월 30일
By gpx files I assume you mean this file format?
Which release are you using? If you're using release R2020b or later try importing the data with readstruct.
Once you have the data imported determining if and where two line segments cross isn't too difficult in theory. But determining if and where two roads or paths in the real world intersect can be trickier.
As a concrete example, MathWorks HQ is on Route 9 in Natick Massachusetts. A little bit west of HQ is another road, Route 27. Both Route 9 and Route 27 have sidewalks beside them. Route 27 crosses Route 9 via a bridge over Route 9. But getting from the sidewalk along Route 9 to the sidewalk along Route 27 can be tricky, especially in winter. I've walked from one road to the other, but the sidewalks don't technically intersect due to the vertical separation.

카테고리

Help CenterFile Exchange에서 Dijkstra algorithm에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by