【发布时间】:2013-03-13 13:49:33
【问题描述】:
我有一个包含 Eastings/Northings 的邮政编码数据库,是否有一个 php 脚本可以转换这些值,以便我可以在谷歌地图上使用它们?
我可以遍历数据库并更改每个值吗?
非常感谢
【问题讨论】:
标签: google-maps geocode
我有一个包含 Eastings/Northings 的邮政编码数据库,是否有一个 php 脚本可以转换这些值,以便我可以在谷歌地图上使用它们?
我可以遍历数据库并更改每个值吗?
非常感谢
【问题讨论】:
标签: google-maps geocode
这是我为此编写的一个 API:
https://www.getthedata.com/bng2latlong
语法:
https://api.getthedata.com/bng2latlong/[easting]/[northing]
例子:
https://api.getthedata.com/bng2latlong/529090/179645
一些非常基本的 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'];
【讨论】: