Forum: Ruby on Rails how to show different markers for current location and nearby locations in gmaps4rails

Posted by unknown (Guest)
on 2013-01-15 22:42
(Received via mailing list)
Hai guys,

Iam using gmaps4rails to show gmaps in my application.iam getting the 
map
pointa right but iam unable to differentiate the current location and 
nerby
locations in my map.my idea  is to use different markers for two 
locations
i did it in the following way but it didnt worked for me

my controller

def profile
   @googlemaplocation=Location.find_by_id("#{params[:clinic_id]}")

    @json1 = @googlemaplocation.to_gmaps4rails do |locations, marker|

  marker.picture({
                  :picture => 
"http://www.google.com/mapfiles/dd-start.png",
                  :width   => 32,
                  :height  => 32
                 })
  end

    @neargooglemaplocation=@googlemaplocation.nearbys(10)
    @json2= @neargooglemaplocation.to_gmaps4rails do |locations, marker|

  marker.picture({
                  :picture => 
"http://www.google.com/mapfiles/dd-start.png",
                  :width   => 32,
                  :height  => 32
                 })
  end

    @json = (JSON.parse(@json1) + JSON.parse(@json2)).to_json

  end

my view

 <%= gmaps(:markers => { :data => @json } ) %>

what should i do if i want to display two different markers on the same 
map

Thanks & Regards
Hari Krishna
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.