谷歌地图 GEO 结果

发布于 2024-08-19 07:10:29 字数 581 浏览 1 评论 0原文

我对谷歌地理结果感到非常沮丧,希望有人能给我建议最好的办法是离开。

我创建了一个 AutoSuggest 功能,您可以在其中开始输入地址,Google 会回复建议。然后,用户选择地址并继续。

但在我希望他们继续下一页之前,我想验证他们的选择。我本以为这会很容易,因为我们只检查谷歌已经给出的内容。但是当我进行验证查找时,它没有显示任何结果。

一些示例代码:

假设我从建议中选择了这个地址:Suffield, CT 06078, USA

然后在验证时我使用这个地址进行第二次查找,即。

$string = "Suffield, CT 06078, USA";    
echo 'http://maps.google.com/maps/geo?output=json&oe=utf8&gl=us&sensor=false&key=[MyKey]&q='.urlencode($string).'';

它给了我错误代码 602 (G_GEO_UNKNOWN_ADDRESS)

当它给我地址时怎么会找不到它?

我怎样才能解决这个问题?

I'm getting really frustrated with Google geo results and hope someone can advise me the best was to go.

I have created a AutoSuggest feature where you can start typing the address and Google will respond with suggestions. User then selects and address to move on.

But before I want them to continue on the next page I want to validate their selection. I would have thought this will be easy as we are only checking against what Google has already given. But when I do my validation lookup it displays no results.

Some example code:

Lets say I picked from the suggestion this address: Suffield, CT 06078, USA

Then on validation I do a second lookup with this address ie.

$string = "Suffield, CT 06078, USA";    
echo 'http://maps.google.com/maps/geo?output=json&oe=utf8&gl=us&sensor=false&key=[MyKey]&q='.urlencode($string).'';

It gives me Error code 602 (G_GEO_UNKNOWN_ADDRESS)

How can it not be found when its given me the address?

How I can get around this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

記柔刀 2024-08-26 07:10:30

确实,这确实很奇怪,但我能够使用完整的州名来验证该地址。

不起作用:

http://maps.google.com/maps/geo?output=json&oe=utf8&gl=us&sensor=false&key=[MyKey]&q=萨菲尔德%20CT%2006078

有效:

http://maps.google.com/maps/geo?output=json&oe=utf8&gl=us&sensor=false&key=[MyKey]&q=萨菲尔德,%20康涅狄格州%2006078

是的,他们提供给您的地址在他们自己的系统中不起作用。话虽这么说,搜索康涅狄格州哈特福德确实有效。看来他们的数据可能存在列表差异,因此 Suffield + CT 返回错误结果。

It's really strange, to be sure, but I was able to validate the address using the full state name.

Doesn't work:

http://maps.google.com/maps/geo?output=json&oe=utf8&gl=us&sensor=false&key=[MyKey]&q=Suffield,%20CT%2006078

Does Work:

http://maps.google.com/maps/geo?output=json&oe=utf8&gl=us&sensor=false&key=[MyKey]&q=Suffield,%20Connecticut%2006078

And yes, the address they provided to you doesn't work in their own system. That being said, searching for Hartford, CT DOES work. It appears there may be a listing discrepency in their data whereby Suffield + CT returns false results.

紫瑟鸿黎 2024-08-26 07:10:29

你说得对。这很奇怪。

请注意,当您删除 CT 和 06078 之间的空格时,它确实起作用:

http://maps.google.com/maps/geo?q=Suffield,+CT06078,+USA&output=csv&sensor=false

上面返回 41.9817631,-72.6506462。 (链接到 Google 地图)


对这些坐标进行反向地理编码:

http://maps.google.com/maps/geo?q=41.9817631,-72.6506462&output=csv&sensor=false

返回:

200,4,"Suffield, CT, USA"

You're right. That is quite strange.

Note that it does work when you remove the space between CT and 06078:

http://maps.google.com/maps/geo?q=Suffield,+CT06078,+USA&output=csv&sensor=false

The above returns 41.9817631,-72.6506462. (Link to Google Maps)


Reverse geocoding those coordinates with:

http://maps.google.com/maps/geo?q=41.9817631,-72.6506462&output=csv&sensor=false

returns:

200,4,"Suffield, CT, USA"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文