控制器.rb
Rails 4.0 + gmaps4rails 2.0.3 + ruby 2.0.0
我想更改谷歌地图上的标记图像。如果我给“图片”=>' http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000 ',如果有人知道该怎么做,什么都不会发生?请分享
谢谢
Gmaps4rails.build_markers(object) do |user, marker|
marker.lat user.latitude
marker.lng user.longitude
marker.infowindow user.location
marker.picture({
"picture" => 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000',
"width" => '16',
"height" => '16'
})
marker.json({:title => user.title})
end
我也在尝试这个,但不同的标记不知道我错在哪里?
def CommonUtils.get_gmap_city_marker(object)
Gmaps4rails.build_markers(object) do |user, marker|
marker.lat user.latitude
marker.lng user.longitude
marker.infowindow user.location
marker.picture({
:picture => "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000", # up to you to pass the proper parameters in the url, I guess with a method from device
:width => 32,
:height => 32
})
marker.json({:title => user.title})
end
end