Ruby on Rails ym4r_gm Google 地图
我正在使用 ym4r_gm 在我的网站上创建标记地图。我创建了 1 个标记,适用于以下代码。
@map = GMap.new("locations_map")
@map.control_init(:large_map => true,:map_type => true)
geocode = GMap::Geocoding.get("G12 8BZ")
@map.record_init @map.add_overlay(GMarker.new([geocode.first.latitude,geocode.first.longitude], :title => "Hillhead, Glasgow", :info_window =>"Hillhead, Glasgow"))
我将如何让一组标记显示在地图上?我有一个邮政编码(邮政编码)数组,如下所示:
postcodes = ["G11 6PR", "G1 T3R", "G12 8BZ"]
我注意到 ym4r_gm 中的 MarkerGroup 类,但我无法弄清楚:-S
如果有人可以帮助我,那将是令人惊奇的,这里是文档的链接还。
http://ym4r.rubyforge.org/ym4r_gm-doc/
如有任何帮助,我们将不胜感激。
干杯
埃夫
I am using ym4r_gm to create a map of markers on my website. I have created 1 marker which is fine with the following code.
@map = GMap.new("locations_map")
@map.control_init(:large_map => true,:map_type => true)
geocode = GMap::Geocoding.get("G12 8BZ")
@map.record_init @map.add_overlay(GMarker.new([geocode.first.latitude,geocode.first.longitude], :title => "Hillhead, Glasgow", :info_window =>"Hillhead, Glasgow"))
How would I go about getting a group of markers to display on the map? I have an array of postcodes (zipcodes) like so:
postcodes = ["G11 6PR", "G1 T3R", "G12 8BZ"]
I have noticed the MarkerGroup class in ym4r_gm but I can not figure it out :-S
If you someone could give me a hand that would be amazing, here is a link to the docs also.
http://ym4r.rubyforge.org/ym4r_gm-doc/
Any help would be appreciated.
Cheers
Eef
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定 ym4r_gm,但使用 ym4r_mapstraction 会是这样的(尽管 ym4r_gm 和 ym4r_mapstraction 都可用,因为我不认为 ym4r_mapstraction 有方便的地理编码助手)
Not sure about ym4r_gm, but with ym4r_mapstraction it would be something like this (although this would be with both ym4r_gm and ym4r_mapstraction available since I dont think ym4r_mapstraction has the handy geocoding helper)