Add collection of markers
Closed this issue · 3 comments
mvondoyannick commented
Hi. Il love this gem but have a few problems.
I have a object that contains a collection of coordinate. How can I do to pass this object to render many markers on tje the same map
map(:center => {
:latlng => [51.52238797921441, -0.08366235665359283],
:zoom => 18
},
:markers => [
<% @coordinate.each do |item| %>
{
:latlng => [<%=item.lon%>,<%= item.lat%>],
}
<% end %>
]
)
Thank for help
pskarlas commented
Take a look at the example below, it should be helpful.
<%=
map(:center => {
:latlng => [38.787554, 22.000368],
:zoom => 6
},
markers: @shops.all.map { |shop| { latlng: [shop.lat, shop.lng], popup: shop.name } }
)
%>
mvondoyannick commented
Take a look at the example below, it should be helpful.
<%= map(:center => { :latlng => [38.787554, 22.000368], :zoom => 6 }, markers: @shops.all.map { |shop| { latlng: [shop.lat, shop.lng], popup: shop.name } } ) %>
work fine thanks
stale commented
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.