我有一个Eastings Northings的邮编数据库,是否有一个php脚本可以转换这些值,这样我就可以在google地图上使用它们?
我可以通过数据库循环并改变每个值吗?
非常感谢
这里是我写的一个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'];