gmaps4rails with Google Maps searchbox

时光总嘲笑我的痴心妄想 提交于 2019-12-13 06:40:13

问题


I'm writing a map applcication with Ruby-on-Rails 3 and gmaps4rails gem. I have the map setup and everything works fine but I would like to have a google maps like searchbox on the top with a dropdown list of possible places, like this:

Is there any easy way of doing this or a plugin that gives this functionality with not to much coding?

Preferably I would like to limit the search results to just one country if that is possible.

Regards, Johann


回答1:


I'm in a similar boat. In the past my application had search implemented with custom JavaScript based on Google Maps API Version 2, now I'm looking to upgrade.

However, in Google Maps API Version 3, there isn't a "enableGoogleBar" option anymore. The good news is that the new "Places" service looks to be the replacement.

You'll want to specifically look at the Places Autocomplete section. The example pretty much exactly describes what you want.

I'm getting into this myself soon. I'll keep you updated with progress I make. If you don't beat me to it first.



来源:https://stackoverflow.com/questions/6809673/gmaps4rails-with-google-maps-searchbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!