算法来计算基于经度和放大器最近的位置;纬度 [英] Algorithm to calculate nearest location based on longitude & latitude

查看:148
本文介绍了算法来计算基于经度和放大器最近的位置;纬度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一种算法来计算其已知位置最接近当前已知位置。

I am currently trying to develop an algorithm to calculate which known locations are closest to current known location.

我有说100已知位置的列表(意思是我有长期和纬度)。在这些100我挑一个位置,并选择该位置我想要一个列表显示后说,8最接近已知位置这一点。

I have a list of say 100 known locations (meaning I have both long- and latitude). Out of these 100 I pick one location, and after picking that location I want a list to show say the 8 closest known locations to this.

如何将一个可能的解决方案是这样做呢?

How would a possible solution be to this?

修改

我不是在寻找如何计算距离。我在寻找如何计算出已知位置位于最接近当前位置

I am not looking for how to calculate distances. I am looking for how to calculate which known locations lies closest to current location.

例如:

说的列表中包含电影院的100个地点。我在剧院5,我想找出列表中的其他电影院在于什么附近。不远处,但他们的位置。

Say the list contains 100 locations of movie theaters. I am at theater 5, and I want to find out what other movie theaters in the list lies nearby. Not the distance, but their location.

推荐答案

有一个的距离矩阵API 。这个API允许你计算某些给定位置之间的距离。

There is a Distance Matrix API. This API allows you to calculate distances between some given positions.

您可以用的haversine公式

You can do this also by your own with a haversine formula

这篇关于算法来计算基于经度和放大器最近的位置;纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆