[Ym4r-user] Clusterer generating javascript syntax error
Joseph Dunn
joseph at magnesium.net
Thu Jan 18 14:29:24 EST 2007
Hi all,
I'm using Ym4r with the Clusterer. The GMaps code in my controller
looks something like this:
# geo is an array of lon/lat points
session[:gmap] = GMap.new('map_div')
session[:gmap].control_init(:large_map => true,:map_type => true)
session[:gmap].center_zoom_init([38.134557,-95.537109],4)
markers = Array.new
geodata.each do |geo|
markers.push(GMarker.new([geo['lon'], geo['lat']],
:info_window => "Hello", :title => "HOYOYO"))
end
clusterer = Clusterer.new(markers, :max_visible_markers => 2)
session[:gmap].overlay_init(clusterer)
Then in my view I'm loading in the requisite javascript libraries,
including clusterer and mapstraction, and then displaying the map with
something like:
<%= session[:gmap].div(:width => 600, :height => 400) %>
However, I get this Javascript error when I view my page:
illegal character
30map.setCenter(new
GLatLng(38.134557,-95.537109),4);map.addOverlay(#<Ym4r::MapstractionPlugin::Clusterer:0x9b3d608>);map.addControl(new
GLargeMapControl());
It seems pretty obvious that a Ruby object reference is somehow
getting inserted into the generated Javascript. Removing the clusterer
lines from my controller solves the problem. Any idea what's going on?
Regards,
Joseph
More information about the Ym4r-user
mailing list