简体   繁体   English

Google Maps V3 Geolocation Rails 3 gem'geocoder'地址不正确

[英]Google Maps V3 Geolocation Rails 3 gem 'geocoder' addresses not correct

I'm using Google Maps V3 and it's not only having trouble getting exact geolocations, it's sometimes not finding the correct city (even missing by more than 50 miles in some cases). 我使用的是Google Maps V3,它不仅难以获取准确的地理位置,而且有时找不到正确的城市(在某些情况下甚至超过50英里)。

The way I'm using google maps is in my Rails 3 app with the gem 'geocoder'. 我使用Google Maps的方式是在我的Rails 3应用程序中使用gem'geocoder'。 I feel pretty sure it's not the geocoder gem that's causing google maps to be off, I think I've had this problem in google maps V3 before. 我可以肯定,不是导致Google地图关闭的不是Geocoder宝石,我想我以前在Google Maps V3中遇到过此问题。

My question: is there a better experience for determining the user's location? 我的问题:确定用户位置是否有更好的体验? Should I use the browser's built in geolocation features? 我应该使用浏览器的内置地理位置功能吗? Or should I be using a combination of Google Maps Geolocation and the browser's geolocation functions? 还是应该结合使用Google Maps Geolocation和浏览器的geolocation功能?

I imagined a scenario where I could ask the user if the town was correct, and if not they could enter their town, then store their town in the database, but it seems like a poor user experience. 我设想了这样一种情况:我可以询问用户城镇是否正确,如果不能,他们可以输入自己的城镇,然后将其城镇存储在数据库中,但是这似乎是糟糕的用户体验。 I hope to make this a app on mobile devices in the future, where it wouldn't be much of a problem, but for now it's a web app. 我希望将来在移动设备上将该应用程序做成一个小问题,但现在它是一个Web应用程序。

Anybody else have a good system for dealing with apps that rely on a user's location? 还有其他人有一个好的系统来处理依赖于用户位置的应用程序吗? Thanks! 谢谢!

I ran into the same problem with Geocoder. 我遇到了与Geocoder相同的问题。 For me it appeared to not interpret the address correctly in certain cases. 对我来说,在某些情况下似乎无法正确解释该地址。 If I sent it '250w 450n' as the street address I would get back the coords for *formatted_address":"250 E 450 S,*. 如果我将其“ 250w 450n”作为街道地址发送给我,则会得到* formatted_address“:” 250 E 450 S,*“的坐标。 If I sent '250 w 450 n' I got back the exact location I was looking for. 如果我发送“ 250 w 450 n”,我会找回我想要的确切位置。 Try checking the json response you get back from Geocoder, it will tell you "partial_match":true,"types":["street_address"]}} if it "guessed" at something, and you can check the returned *formatted_address* to see what it came up with. 尝试检查从Geocoder返回的json响应,它会告诉您“ partial_match”:true,“ types”:[“ street_address”]}}}如果它被“猜测”到了什么地方,那么您可以检查返回的* formatted_address *看看结果如何。

you can use their website as a quick check on what response you would get for a given address string. 您可以使用他们的网站快速查看给定地址字符串的响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM