I have millions of samping sations, my goal is to find the nearby stations with a certain distance threshold. What is the best way to do it based on the longitude and latitude information?
It seems that calculating the stations between each of them is extremely time-consuming.
Thanks.

6 件のコメント

dpb
dpb 2021 年 4 月 11 日
編集済み: dpb 2021 年 4 月 12 日
A direct lookup/calculation of all distances from a given point for every case would seem prohibitively expensive, agreed.
I'm sure there are more sophisticated ways to go at it, but you could start to reduce the search space by eliminating all which are farther away in either direction alone and only doing the full calculation within that grid.
You could in all likelihood reduce those distances by some sizable fraction and not miss the result -- say by sqrt(2)
Leon
Leon 2021 年 4 月 11 日
Many thanks for sharing the great thoughts!
dpb
dpb 2021 年 4 月 11 日
Another way to approach it if the database is static would be to compute the distance once and save it -- then it's just a lookup for each station pair that could be read from an indexed file.
It would likely be too large to store the whole distance matrix for all stations at once, anyway.
dpb
dpb 2021 年 4 月 11 日
Another way if one is always going to be wanting only other stations within some distance of a given station would be to precompute as above, but only save those locations for each station within that magic cutoff distance. Depending upon that distance and the distribution of stations, this could possibly reduce the size of the database significantly.
Leon
Leon 2021 年 4 月 12 日
Many thank for the recommendations.
It would be great if Mathworks could develop a function to allow me to easily find nearby sations with a specific radius (considering the land mask as well).
dpb
dpb 2021 年 4 月 12 日
I would presume there are tools in the Mapping Toolbox (which I don't have) similar to pdist2 in base product, but I really don't know much at all about what is available.

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

回答 (1 件)

Shadaab Siddiqie
Shadaab Siddiqie 2021 年 4 月 16 日

0 投票

From my understanding you want to speed up the process of finding the nearest location. You can use pdist2 to find pair-wise distance of all the point in a range or you can also use dsearchn to find nearest point.

1 件のコメント

dpb
dpb 2021 年 4 月 16 日
Neither of which address that OP's coordinates are in lat, long, not x,y,z...

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

製品

リリース

R2021a

質問済み:

2021 年 4 月 11 日

コメント済み:

dpb
2021 年 4 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by