Just started using YM4R to display a Google Map. I can display a map with 1 Marker. But, I''d like to initialize the map with multiple markers. Does anyone know how to do that? I''ve tried: def index @map = GMap.new("map_div") @map.control_init(:large_map => true,:map_type => true) @map.center_zoom_init([47.2700000, -122.311880],15) @map.overlay_init(GMarker.new([47.2700000, -122.311880],:title => "Hello", :info_window => "Info! Info!")) @map.add_overlay(GMarker.new([47.2700000, -122.311800],:title => "M2", :info_window => "Marker 2")) end The .add_overlay(..) doesn''t display. Also, Does anyone know how to get the GPS coordinates for a street address? -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson --~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Can''t you just feed in an array of markers? @markers.each do |marker_seq| @map.overlay_init(marker_seq) end On Mar 1, 2007, at 7:12 AM, Larry Kelly wrote:> Just started using YM4R to display a Google Map. I can display a > map with 1 Marker. But, I''d like to initialize the map with > multiple markers. Does anyone know how to do that? > > I''ve tried: > > def index > @map = GMap.new("map_div") > @map.control_init(:large_map => true,:map_type => true) > @map.center_zoom_init([47.2700000, -122.311880],15) > @map.overlay_init(GMarker.new([47.2700000 , -122.311880],:title > => "Hello", :info_window => "Info! Info!")) > @map.add_overlay(GMarker.new([47.2700000, -122.311800],:title > => "M2", :info_window => "Marker 2")) > end > > The .add_overlay(..) doesn''t display. > > Also, > Does anyone know how to get the GPS coordinates for a street address? > > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Benson > >--~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, that worked, (once I moved the coordinated far enough apart that both markers would display). -Larry On 3/1/07, Hunter Hillegas <lists-HAWAbpnI61OZ1JSuHaJ1sQC/G2K4zDHf@public.gmane.org> wrote:> > > Can''t you just feed in an array of markers? > > @markers.each do |marker_seq| > @map.overlay_init(marker_seq) > endThis haven''t figured out how to get the longitude, latitude for a given US address. Should I put that question in a separate post? -Larry On Mar 1, 2007, at 7:12 AM, Larry Kelly wrote:> > > Just started using YM4R to display a Google Map. I can display a > > map with 1 Marker. But, I''d like to initialize the map with > > multiple markers. Does anyone know how to do that? > > > > I''ve tried: > > > > def index > > @map = GMap.new("map_div") > > @map.control_init(:large_map => true,:map_type => true) > > @map.center_zoom_init([47.2700000, -122.311880],15) > > @map.overlay_init(GMarker.new([47.2700000 , -122.311880],:title > > => "Hello", :info_window => "Info! Info!")) > > @map.add_overlay(GMarker.new([47.2700000, -122.311800],:title > > => "M2", :info_window => "Marker 2")) > > end > > > > The .add_overlay(..) doesn''t display. > > > > Also, > > Does anyone know how to get the GPS coordinates for a street address? > > > > -- > > Best Regards, > > -Larry > > "Work, work, work...there is no satisfactory alternative." > > --- E.Taft Benson > > > > > > > >-- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson --~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Found the answer to the coordinate problem. Way at the bottom of the readme, it mentions in passing that GMarker now accepts strings as well as coordinates. So all I have to do is: @address = GMarker.new("some address that Google can find") Very cool! There is also a Geocode::Get method that queries Google and returns coordinate info. Haven''t played with it yet. -Larry On 3/1/07, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thanks, that worked, (once I moved the coordinated far enough apart that > both markers would display). > -Larry > > On 3/1/07, Hunter Hillegas < lists-HAWAbpnI61OZ1JSuHaJ1sQC/G2K4zDHf@public.gmane.org> wrote: > > > > > > Can''t you just feed in an array of markers? > > > > @markers.each do |marker_seq| > > @map.overlay_init(marker_seq) > > end > > > This haven''t figured out how to get the longitude, latitude for a given US > address. Should I put that question in a separate post? > -Larry > > On Mar 1, 2007, at 7:12 AM, Larry Kelly wrote: > > > > > Just started using YM4R to display a Google Map. I can display a > > > map with 1 Marker. But, I''d like to initialize the map with > > > multiple markers. Does anyone know how to do that? > > > > > > I''ve tried: > > > > > > def index > > > @map = GMap.new ("map_div") > > > @map.control_init(:large_map => true,:map_type => true) > > > @map.center_zoom_init([47.2700000, -122.311880],15) > > > @map.overlay_init(GMarker.new([47.2700000 , -122.311880 ],:title > > > => "Hello", :info_window => "Info! Info!")) > > > @map.add_overlay(GMarker.new([47.2700000, -122.311800],:title > > > => "M2", :info_window => "Marker 2")) > > > end > > > > > > The .add_overlay(..) doesn''t display. > > > > > > Also, > > > Does anyone know how to get the GPS coordinates for a street address? > > > > > > -- > > > Best Regards, > > > -Larry > > > "Work, work, work...there is no satisfactory alternative." > > > --- E.Taft Benson > > > > > > > > > > > > > > > > > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Benson >-- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson --~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hunter Hillegas wrote:> Can''t you just feed in an array of markers? > > @markers.each do |marker_seq| > @map.overlay_init(marker_seq) > endHi Hunter I have a similar problema with YM4R My map only display the last point, this is my code: @map = GMap.new("map_div_id") @map.control_init(:large_map => true, :map_type => true) @map.center_zoom_init([40.41,-3.70], 4) markers = Array.new() for lab in @laboratories do html = gethtmlmap(lab) c1, c2 = lab.coords.split(",") markers << GMarker.new([c1.to_i,c2.to_i], :title => lab.name, :info_window => html) end markers.each do |marker_seq| @map.overlay_init(marker_seq) end Could you help me please? Thanks in advance -- Posted via 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
Just a quick link to some example code that may help you: github.com/kete/kete/blob/master/app/views/search/_results.rhtml # lines 43 - 63ish Pay particular attention to lines 61 and 62. Hope that helps, Walter -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
Walter McGinnis wrote:> Just a quick link to some example code that may help you: > > github.com/kete/kete/blob/master/app/views/search/_results.rhtml > # lines 43 - 63ish > > Pay particular attention to lines 61 and 62. > > Hope that helps, > WalterHi Walter, thanks for your reply My original code were like this post, with it, only show the last result of my query, like this: @map = GMap.new("map_div_id") @map.control_init(:large_map => true, :map_type => true) @map.center_zoom_init([40.41,-3.70], 4) for lab in @laboratories do html = gethtmlmap(lab) c1, c2 = lab.coords.split(",") marker = GMarker.new([c1.to_i,c2.to_i], :title => lab.name, :info_window => html) @map.overlay_init(marker) end I don''t know what is wrong. Thanks! -- Posted via 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
Hmm, I don''t see an obvious cause for the problem. I would chuck in a debug on @map and perhaps marker objects to see what they look like. One difference that my code has (in the controller where @map object is initialized) is that it uses this: @map.center_zoom_on_points_init(*@coordinates_for_results) I would say that implies that it can handle multiple markers, but if it is what turns on support for multiple markers it''s pretty unexpected. Hope this helps, Walter On Mon, Sep 20, 2010 at 7:49 PM, Twistter Shock <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Walter McGinnis wrote: >> Just a quick link to some example code that may help you: >> >> github.com/kete/kete/blob/master/app/views/search/_results.rhtml >> # lines 43 - 63ish >> >> Pay particular attention to lines 61 and 62. >> >> Hope that helps, >> Walter > > Hi Walter, thanks for your reply > > My original code were like this post, with it, only show the last result > of my query, like this: > > > @map = GMap.new("map_div_id") > @map.control_init(:large_map => true, :map_type => true) > @map.center_zoom_init([40.41,-3.70], 4) > > for lab in @laboratories do > html = gethtmlmap(lab) > c1, c2 = lab.coords.split(",") > > marker = GMarker.new([c1.to_i,c2.to_i], > :title => lab.name, :info_window => html) > -mDGcsIj0EBRcKHiaeZqq9g@public.gmane.org_init(marker) > end > > I don''t know what is wrong. > > Thanks! > -- > Posted via 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Sep 21, 2010 at 9:22 AM, Walter McGinnis <walter.mcginnis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > One difference that my code has (in the controller where @map object > is initialized) is that it uses this: > > @map.center_zoom_on_points_init(*@coordinates_for_results) >This indeed is the source of your problem I think. You code centers on one specific point with a zoom level of 4. If your markers don''t fall within the map''s area as centered around this point at this zoom level, they appear to not exist. However, they are simply not visible. To test my theory, simply try zooming out and see if the other markers appear. With multiple markers you almost certainly want to use the center_zoom_on_points_init method to get a map that will show all points. There is a decent walk through of the process here: codequest.eu/articles/google-maps-rails-and-solr-spatial-search Cheers, Walter -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
Walter McGinnis wrote:> On Tue, Sep 21, 2010 at 9:22 AM, Walter McGinnis > <walter.mcginnis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> One difference that my code has (in the controller where @map object >> is initialized) is that it uses this: >> >> @map.center_zoom_on_points_init(*@coordinates_for_results) >> > > This indeed is the source of your problem I think. You code centers on > one specific point with a zoom level of 4. If your markers don''t fall > within the map''s area as centered around this point at this zoom > level, they appear to not exist. However, they are simply not > visible. > > To test my theory, simply try zooming out and see if the other markers > appear. > > With multiple markers you almost certainly want to use the > center_zoom_on_points_init method to get a map that will show all > points. There is a decent walk through of the process here: > > codequest.eu/articles/google-maps-rails-and-solr-spatial-search > > Cheers, > WalterHi Walter! Thanks for your reply. I tried with zoom level 0 and only display the last result of the recordset :-S I will read this article and try again. Thanks! -- Posted via 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.