开发者

Integrating a google map into rails

开发者 https://www.devze.com 2023-01-01 05:37 出处:网络
Has anyone got any suggestions on whe开发者_运维百科re to start with building a google map into a rails app? I would like users to be able to add a marker by clicking the map, and have spent a few day

Has anyone got any suggestions on whe开发者_运维百科re to start with building a google map into a rails app? I would like users to be able to add a marker by clicking the map, and have spent a few days looking for a suitable tutorial or plugin (beyond ym4r), to little avail...any help would be much appreciated as I am finding the Google Maps API rather difficult to get into! I've also come across the railskit for google maps - does anyone have any experience in using it?


Just fyi, I made https://rubygems.org/gems/gmaps4rails which is a useful wrapper with several options.


I probably wouldn't use YM4R. We tried it and found that it doesn't add much value because it just wraps the API. I would recommend working with Google Maps directly from JavaScript. Google Maps API documentation is pretty good, and there are quite a few examples on the web.

There is an example of a click handler on the map here, and adding a marker is just a matter of doing

map.addOverlay(new GMarker(latlng));
0

精彩评论

暂无评论...
验证码 换一张
取 消