views:

23

answers:

2

I'm looking into building a group work app for my final year project next year. One of the core parts is organising group meetings. I plan to make this as powerful as possible and adding a map can help get rid of excuses such as "I didn't know where it was".

I have been unable to find any simple solutions to embed maps into my Rails apps so far. An important issue is I need Rails 3 Compatibility.

What are your suggestions? Gems, plugins or even something totally different?

+1  A: 

The Geokit gem is what you'll want for doing lat/lng look ups using ips or addresses. It works well from the command line as well, if you want to look up and cache the results before hand.

As far as the map itself is concerned, I just went through this process and it really is just html/javascript that needs to be copied into a view or layout, inserting a loop for marking addresses and just a few variables if you want to set options like zoom level. Just get a static page to work, and turn that into your view really and replace your options with variables just like you would with any other page.

One thing I'll add is that every module (ruby or javascript) seems to refer to latitude and longitude as "lat" and "lng". So I have this ugly mix of long and short names for the same pieces of data that I'll get around to fixing "some day".

LanceH
This was exactly what I was looking for, thanks.
Port3M5
A: 
addr = CGI.escape(@location.address + ',' + @location.city_name + ',' + @location.state_abbr + ',' + @location.zip_code)

<%= image_tag "http://maps.google.com/maps/api/staticmap?center=#{addr}&amp;zoom=16&amp;size=600x400&amp;markers=color:blue|#{addr}&amp;sensor=false" %>
Jarrod