谷歌地图 GEO 结果
我对谷歌地理结果感到非常沮丧,希望有人能给我建议最好的办法是离开。
我创建了一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确实,这确实很奇怪,但我能够使用完整的州名来验证该地址。
不起作用:
有效:
是的,他们提供给您的地址在他们自己的系统中不起作用。话虽这么说,搜索康涅狄格州哈特福德确实有效。看来他们的数据可能存在列表差异,因此 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:
Does Work:
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.
你说得对。这很奇怪。
请注意,当您删除 CT 和 06078 之间的空格时,它确实起作用:
上面返回 41.9817631,-72.6506462。 (链接到 Google 地图)
对这些坐标进行反向地理编码:
返回:
You're right. That is quite strange.
Note that it does work when you remove the space between CT and 06078:
The above returns 41.9817631,-72.6506462. (Link to Google Maps)
Reverse geocoding those coordinates with:
returns: