Calculate distance considering road network

2 ビュー (過去 30 日間)
JOVANI
JOVANI 2023 年 5 月 1 日
コメント済み: Chunru 2023 年 5 月 2 日
I would like to calculate the distance between two coordinates using Matlab. However, this distance I would like to consider the road network. I wouldn't want to use any google API ok. The latitude and longitude of the two points are below:
% Coordinates of the points:
lat1 = -22.8851078223344;
lon1 = -48.4939312250395;
lat2 = -22.8315940282463;
lon2 = -48.4298167144681;

回答 (1 件)

Chunru
Chunru 2023 年 5 月 2 日
lat1 = -22.8851078223344;
lon1 = -48.4939312250395;
lat2 = -22.8315940282463;
lon2 = -48.4298167144681;
% need mapping toolbox
arclen = distance(lat1, lon1, lat2, lon2)
arclen = 0.0797
d = deg2km(arclen)
d = 8.8636
  2 件のコメント
JOVANI
JOVANI 2023 年 5 月 2 日
編集済み: JOVANI 2023 年 5 月 2 日
Thanks for the answer, but I believe that the distance function does not consider the road network. Any other suggestions?
Chunru
Chunru 2023 年 5 月 2 日
How do you specify road network? Can you give a simple example?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by