【问题标题】:Google maps finds locations that its API doesn'tGoogle 地图可以找到其 API 无法找到的位置
【发布时间】:2016-12-18 14:44:38
【问题描述】:

以下网址失败:

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

想法?

【问题讨论】:

标签: google-maps google-api


【解决方案1】:

您应该知道,Geocoding 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-12
    相关资源
    最近更新 更多