用PHP计算邮政编码之间的距离 [英] Calculating distance between zip codes in PHP

查看:34
本文介绍了用PHP计算邮政编码之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从中获取了邮政编码及其纬度/纬度等的数据库此页面.它有以下字段:

I grabbed a database of the zip codes and their langitudes/latitudes, etc from this This page. It has got the following fields:

邮政编码、纬度、经度、城市、州、县、邮政编码

ZIP, LATITUDE, LONGITUDE, CITY, STATE, COUNTY, ZIP_CLASS

数据在文本文件中,但我将其插入到 MySQL 表中.我现在的问题是,我如何利用上面的字段来计算用户可以在网站上输入的两个邮政编码之间的距离?PHP 中的工作代码将不胜感激

The data was in a text file but I inserted it into a MySQL table. My question now is, how can i utilise the fields above to calculate the distance between two zip codes that a user can enter on the website? Working code in PHP will be appreciated

推荐答案

您也可以尝试点击 Web 服务来计算距离.让其他人做繁重的工作.

You can also try hitting a web service to calc the distance. Let someone else do the heavy lifting.

https://www.zipcodeapi.com/API#distance

这篇关于用PHP计算邮政编码之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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