Plugins - GoogleMaps

StarAdd to favorites

To Use:

1 - Set your Google Maps API Key in environment.rb (or somewhere else if you’d prefer)

  # This key is good for localhost:3000, signup for more at http://www.google.com/apis/maps/signup.html
  GOOGLE_APPLICATION_ID = "ABQIAAAA3HdfrnxFAPWyY-aiJUxmqRTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ0KYLwBEKSM7F9gCevcsIf6WPuIQ"

2 - Do something like this in a view.

  <%
  map = GoogleMap.new
  map.markers << GoogleMapMarker.new(:map => map,
                                     :lat => 47.6597,
                                     :lng => -122.318,
                                     :html => 'My House')
  %>
  <%= map.to_html %>

    <%= map.div %>

Advanced Usage

1 - Use included icon classes

  # Available icon classes:
  # GoogleMapLetterIcon.new('A')
  # GoogleMapSmallIcon.new('yellow')
  <%
  map = GoogleMap.new
  icon = GoogleMapSmallIcon.new('blue')
  map.markers << GoogleMapMarker.new(:map => map,
                                     :icon => icon,
                                     :lat => 47.6597,
                                     :lng => -122.318,
                                     :html => 'My House')
  %>
  <%= map.to_html %>

    <%= map.div %>

http://gmaps-on-rails.googlecode.com/svn/trunk

  • Currently 4.1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

View Extensions

Tags

Comments

Add a comment
Patrick 12 Jun 2008

The repository has moved to: http://gmaps-on-rails.googlecode.com/svn/trunk

Andy 29 May 2007

I prefer a map that takes an address rather than co-ordinates, as most of our apps hold address details and few, i imagine, hold co-ordinates.

Check out this plugin that is currently written for the Hobo Rails plugin, but can easily be refactured as a standard Rails plugn (i'll get onto that asap) - http://hobocentral.net/forum/viewtopic.php?t=526

dennis 17 Sep 2006

anyone got this working yet? i cant seem to figure it out.

Aurélien 16 Aug 2006

Ok, had to svn co this plugin, svn co unbackeddomid (on the same level as google_maps), write 2 little init.rb files to load the files, and it worked.

Aurelien 15 Aug 2006

How on earth do you install this plugin???

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?