Google地图会查找其API未找到的位置

时间:2016-12-18 14:44:38

标签: google-maps google-api

以下网址失败:

https://maps.googleapis.com/maps/api/geocode/json?address=Wisdom+Hospice+High+Bank+Rochester+Kent+England&key=YOUR_KEY_GOES_HERE

结果这个程序失败了:

#!/usr/bin/env perl

use strict;
use warnings;
use Geo::Coder::Google;
use Data::Dumper;

my $gcg = Geo::Coder::Google->new(apiver => 3);

my @l = $gcg->geocode(location => 'Wisdom Hospice, High Bank, Rochester, Kent, England');

print Data::Dumper->new([@l])->Dump();

然而,如果我在谷歌地图上搜索“智慧临终关怀高银行罗切斯特肯特英格兰”,它的工作原理是:

https://www.google.com/maps/place/Wisdom+Hospice/@51.3725664,0.5071468,17z/data=!3m1!4b1!4m5!3m4!1s0x47d8cce4198bb5ed:0xcc28f53d7161955d!8m2!3d51.3725631!4d0.5093408

思想?

1 个答案:

答案 0 :(得分:2)

您应该知道地理编码API仅适用于街道地址,任何业务结果都不在范围内。

在您的例子中,“智慧临终关怀”是营业场所。在这种情况下,Places API是正确使用的API。

您可以执行以下Places API请求来获取此位置:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=wisdom%20hospice%20high%20bank%20rochester%20kent%20england&key=YOUR_API_KEY