需要找到所有拉链codeS半径范围内英里从指定ZIP codeS [英] Need to find all zip codes within a radius in miles from a specified zipcodes

查看:164
本文介绍了需要找到所有拉链codeS半径范围内英里从指定ZIP codeS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何让经度和纬度,从一个zip code。 我也有与他们的拉链codeS和协调多个位置的数据库。

I know how to get longitudes and longitudes from a zip code. I also have a database with multiple locations with their zip codes and coordinates.

我想找到根据半径上的纬度和经度的界限,然后匹配起来反对我的数据库的可能性。

I want to find the limits of a latitude and longitude based on the radius and then to match them up against possibilities in my database.

我读了半正矢?式。但是,我不明白这和寻找如何找到纬度和经度的范围作出解释。

I read about the haversine?? formula. But, i don't understand it and looking for an explanation of how to find the limits of the latitude and longitudes.

推荐答案

半正弦波是地理计算,这里的弯曲全球影响的距离。特别是对于短距离无关。

Haversine is for geographic calculations, where the curving globe influences distances. Especially for short distances irrelevant.

鉴于地球半径R:

Δ y = (ΔLatitude mod 360)  * 2π R / 360

但到达一个极点(纬度=±90)。

But a Δ longitude gets 0 when reaching a pole (latitude = ±90).

Δ x = (ΔLongitude mod 360)  * 2π R * (90 - |avg latitude|) / 90 / 360
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~

(划线部分应该是像 COS弧度(平均纬度)但SQL很少提供了一个余弦函数。)

(The underlined part should be something like cos(avg latitude in radians) but SQL rarely provides a cosine function.)

因此​​

distance = √(Δx² + Δy²)

这篇关于需要找到所有拉链codeS半径范围内英里从指定ZIP codeS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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