将Eastings Northings转换为经纬度?

问题描述 投票:1回答:1

我有一个Eastings Northings的邮编数据库,是否有一个php脚本可以转换这些值,这样我就可以在google地图上使用它们?

我可以通过数据库循环并改变每个值吗?

非常感谢

google-maps geocode
1个回答
0
投票

这里是我写的一个API,正是这样做的。

https:/www.getthedata.combng2latlong

语法。

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

例子。

https:/api.getthedata.comng2latlong529090179645。

一些非常基本的PHP代码可能是这样的。

$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'];
© www.soinside.com 2019 - 2024. All rights reserved.