PHP:从 Google Maps API 获取所有可能的结果时遇到问题
最近,我在使用 Google Maps API 帮助我正在开发的网站时注意到了某些细微差别。具体来说,我注意到,在应该返回多个位置的情况下,Google 地图只会返回一个位置。
示例:惠特菲尔德 在 Google 地图中返回 10 个地点,这很好。
但是,海湾港口 返回伊利诺伊州的 1 个地点,尽管它也应该返回佛罗里达州的另一个地点 ( 佛罗里达州海湾港 )。
同样,圣彼得堡 返回俄罗斯的 1 个地点,尽管它也应该返回佛罗里达州的另一个地点 ( 佛罗里达州圣彼得堡 )。
我怎样才能让谷歌返回它应该列出的所有位置,100%的时间?我需要使用一个参数吗?我查看了“bounds”参数,我想我也许可以用它来获取所有结果 设置涵盖整个世界的界限 ,但我没有任何运气。
I've recently noticed certain nuances when using Google Maps API to help in a site I'm developing. Specifically, I've noticed that Google Maps will only return a single location in instances where multiple locations should have been returned.
Examples, Whitfield
in Google Maps returns 10 places, which is fine.
But, Gulf Port
returns 1 place in IL, even though it should be returning another place in Florida as well ( Gulf Port, FL
).
Likewise, Saint Petersburg
returns 1 place in Russia, even though it should be returning another place in Florida as well ( Saint Petersburg, FL
).
How can I get google to return ALL of the locations that it should be listing, 100% of the time? Is there an argument I need to use? I've taken a look at the 'bounds' arg which I thought I could perhaps use to get all results by
setting the bounds to encompass the entire world
, but I didn't have any luck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,谷歌地图的 api 似乎存在区域偏差,即使关闭或未指定,也会返回某些结果而不包含其他结果。这解释了我在同名国家所面临的问题,但并没有解释像我提到的海湾港口问题这样的所有情况。
我得出的结论是,唯一的解决方案是指定城市、州/省。
So, it would appear that the api for googlemaps has a region bias that, even when turned off or left unspecified, will return certain results and not include others. This explains the issues I faced with countries that share the same name, but does not explain at all instances like the Gulf Port issue which I mentioned.
I've concluded that the only solution is to specify a city, state / province.