From joseph at magnesium.net Thu Jan 18 14:29:24 2007 From: joseph at magnesium.net (Joseph Dunn) Date: Thu, 18 Jan 2007 13:29:24 -0600 Subject: [Ym4r-user] Clusterer generating javascript syntax error Message-ID: <61e1747e0701181129u6519909fsf28dd275955afaca@mail.gmail.com> 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(#);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 From guilhem.vellut at gmail.com Thu Jan 18 14:43:56 2007 From: guilhem.vellut at gmail.com (Guilhem Vellut) Date: Thu, 18 Jan 2007 20:43:56 +0100 Subject: [Ym4r-user] Clusterer generating javascript syntax error In-Reply-To: <61e1747e0701181129u6519909fsf28dd275955afaca@mail.gmail.com> References: <61e1747e0701181129u6519909fsf28dd275955afaca@mail.gmail.com> Message-ID: <43f4b6ee0701181143l31e645e1iede5d467ef5f6afd@mail.gmail.com> Hello, If you have installed the mapstraction plugin try again after having uninstalled it. guilhem On 1/18/07, Joseph Dunn wrote: > > 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(#);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 > _______________________________________________ > Ym4r-user mailing list > Ym4r-user at rubyforge.org > http://rubyforge.org/mailman/listinfo/ym4r-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20070118/fa22180c/attachment-0001.html