Ruby on rails gem for google map integration

I would like to ask which is the best solution for integrating google maps into ruby on rails apps. Is a specific gem worth it or should we write our own views for it?

Thanks for any input.

Answers


I've used the YM4R, Georuby and spatial adapter gems with good results before. see this description.


Fyi, I've finished a stable release of gmaps4rails.

See: https://github.com/apneadiving/Google-Maps-for-Rails


If your requirements are only to show google map of specific region, possibly with some markers, you can use Google Maps Static Image API, for example:

<img src="http://maps.google.com/maps/api/staticmap?size=255x255&maptype=roadmap&sensor=false&markers=color:blue|label:A|Chicago,IL&markers=color:purple|label:B|Hammond,IN" alt="Static, Marked Map of Chicago, Illinois and Hammond, Indiana with no Center and Zoom"></img>

The result is:

Here is a good article on subject. Also it's possible to specify geo location with latitude and longitude on markers:

markers=color:pink|label:A|55.783041, -137.500994

So in Rails you can use, for example, image_tag with google map image path helper:

= image_tag google_map_image_path, :alt => "Google Map"

As of November 2012,the best gem for google map integration which I have found is geocoderIt provides object geocoding (by street or IP address), reverse geocoding (coordinates to street address), distance queries for ActiveRecord and Mongoid, result caching, and more. Designed for Rails but works with Sinatra and other Rack frameworks too.

You can get a railscasts too.


GoogleMaps gem is a nice one. It adds all basic JS scripts but a full-functional dynamic map can't be done without JS coding anyway.

There are also JS plugins, the most attractive of them are gmap3, Maplace.Js and gmaps.js.

Gems and plugins allow saving time on basic things but using them imposes some restrictions. For example, if Google makes changes in its Maps API, you have to wait for an updated version of the gem or plugin or integrate manually.

In fact, there is no major difficulty in integrating Google Maps into Rails app and IMHO it makes sence to do it without gems.

See this article for a detailed walkthrough on integrating Google Maps into ruby on rails apps: How to Integrate Google Maps into Ruby on Rails App.


Need Your Help

How can I verify that I am running on a given GCD queue without using dispatch_get_current_queue()?

ios macos objective-c-blocks grand-central-dispatch

Recently, I had the need for a function that I could use to guarantee synchronous execution of a given block on a particular serial dispatch queue. There was the possibility that this shared function

Using jQuery replaceWith to replace content of DIV only working first time

javascript jquery replacewith

I'm using the following jQuery to pull new data and replace the contents of the DIV listdata