I''m trying to use the clusterer with YM4R and simply can''t get
it to
work. I''ve gone through the readme and think I''m following
everything
exactly. Before I started trying to implement the clusterer, my map was
displaying fine. No I can''t even get the map to show up on the page.
I''ve done some google searches and can''t find any examples of
how to
implement this. Any help would be greatly appreciated.
Here''s the code. There are multiple places in the controller where
I''ve
tried different things and they haven''t worked, so I''ve
commented them
out.
In my view:
<% if nil != @map %>
<%= GMap.header %>
<%= javascript_include_tag("clusterer") %>
<%= @map.to_html %>
<% end %>
In my controller
def view_dealers
@prodlist = Product.find_all
@map = GMap.new("map_div")
@map.control_init(:large_map => true,:map_type => true)
@map.center_zoom_init([38.4, -100],4)
gmarkers = Array.new
@dealers = Dealer.find(:all, :order => "state_id ASC, name ASC")
@dealers.each do |dealer|
unless dealer.address == ""
dealer_address = dealer.address + " " + dealer.city + ", " +
\
dealer.state.name + " " + dealer.zip
unless dealer.phone == ""
dealer_phone = "Phone: " + dealer.phone + "<br>"
else
dealer_phone = ""
end
unless dealer.fax == ""
dealer_fax = "Fax: " + dealer.fax + "<br>"
else
dealer_fax = ""
end
dealer_title = dealer.name
info_window_text = dealer.name + "<br> " + dealer.address +
"<br> " + \
dealer.city + ", " + dealer.state.name + " " + dealer.zip +
"" \
"<br>" + dealer_phone + dealer_fax + \
"<a href=" + dealer.url + ">" + dealer.url +
"</a>"
else
info_window_text = "Street address not specified"
end
# Attempt to put GMArkers in array to create cluster
gmarkers.push(GMarker.new(dealer_address,:title => dealer_title,
:info_window => info_window_text))
#gmarkcluster.AddMarker(gmarkers[gmarkers.size])
end
gmarkcluster = Clusterer.new(gmarkers, :min_markers_per_cluster => 2)
@map.overlay_init gmarkcluster
#@map.addOverlay(gmarkcluster)
#@map.overlay_global_init(GMarkerGroup.new(true,gmarkers),"mycluster")
end
Again, I''m desperate for help. Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---