【问题标题】:Convert Eastings/ Northings to Longitude/ Latitude?将东向/北向转换为经度/纬度?
【发布时间】:2013-03-13 13:49:33
【问题描述】:

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

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

非常感谢

【问题讨论】:

标签: google-maps geocode


【解决方案1】:

这是我为此编写的一个 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'];

【讨论】:

    猜你喜欢
    • 2011-12-13
    • 1970-01-01
    • 1970-01-01
    • 2020-09-13
    • 2019-01-23
    • 2016-10-09
    • 1970-01-01
    • 1970-01-01
    • 2012-12-30
    相关资源
    最近更新 更多