将Eastings/Northings转换为经度/纬度? [英] Convert Eastings/ Northings to Longitude/ Latitude?

查看:136
本文介绍了将Eastings/Northings转换为经度/纬度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含Eastings/Northings邮政编码的数据库,是否有一个PHP脚本可以转换这些值,以便可以在Google地图上使用它们?

I have a database of postcodes with Eastings/ Northings, is there a php script that can convert these values so I can use them on google maps?

我可以遍历数据库并更改每个值吗?

Can I loop through the database and change each value?

非常感谢

推荐答案

这是我编写的API,用于执行以下操作:

Here is an API I wrote to do exactly this:

https://www.getthedata.com/bng2latlong

语法:

https://api.getthedata.com/bng2latlong/[easting]/[northing]

示例:

https://api.getthedata.com/bng2latlong/529090/179645

一些非常基本的PHP代码可能看起来像这样:

Some very basic PHP code might look like this:

$easting = 529090;
$northing = 179645;

$json = file_get_contents("https://api.getthedata.com/bng2latlong/$easting/$northing");

$arr = json_decode($json, true);

$latitude = $arr['latitude'];
$longitude = $arr['longitude'];

这篇关于将Eastings/Northings转换为经度/纬度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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