distance from us location to canada border

2 ビュー (過去 30 日間)
Daniel Pinto
Daniel Pinto 2019 年 9 月 17 日
回答済み: Ted Shultz 2019 年 9 月 17 日
Is there any matlab functionality or tool that allows me to find the minimal distance of a location to the border with canada , having as inputs the zipcode and lat/long of the location?

採用された回答

Ted Shultz
Ted Shultz 2019 年 9 月 17 日
I don’t know of a direct function to measure distance from a country, but I did need to do something very similar. This is how I did it:
1) I found a map file that gave the lat/lon of the county of interest. You can find help for Canada here:
2) I interpolated the segments that that no segment was too far apart from each other (“too far apart” is driven by your accuracy requirements). More points = more accurate at short distances
3) I calculated the distance from my input point to all these points using the distance function. The shortest value is your answer.
A more elegant solution may be to compare your input point against all the line segments rather than just the points defining your country outline.

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by