Ruby on rails geocoder gem reverse-geocoding produces significant error - ruby-on-rails

I'm using the goecoder gem for ruby on rails and I found that accuracy is a problem with its built-in database (which I think is google goecoder). The location returned could be as much as several miles from the actual location. For the purpose of the website I'd like to have as little error as possible, so is there an alternative database option for this gem or should I resort to an entirely different one?

There are alternative services you can check out. It's listed in the read me. In addition to Google, there's Bing, Mapquest and a bunch of other services.

Related

Users Geo location

So, I have to display the city where the our users are visiting from.
I could do it in HTML5 but our targeted visitor won't understand the action to allow geo location: example here. Also they probably don't have an updated browser.
So We currently have a ruby on rails stack. I was thinking of using the geokit rails gem but I'm not sure this is the best solution.
What would be a fast and cheap solution ?
I'd recommend checking out the geocoder gem and utilizing the default IP lookup logic for the incoming request.
As far as I know, geocoder is more maintained these days than GeoKit, and provides the functionality you're looking for "out of the box."

Is there a ruby gem to get the search ranking of a URL for a given keyword with Google, Bing or Yahoo?

I am trying to find a gem that will help me get the search ranking of a URL with the popular search engines. I've done a little digging and found some outdated ruby gems - namely:
Keyword Ranking: https://github.com/crowdint/keyword_ranking
Rankstar: https://github.com/crowdint/rankstar/blob/master/lib/rankstar.rb
Both seem to be over 2-3 years old and don't seem to be working (i.e. when I install the gem, create a ruby script and run it, I get nothing returned) - is there a more recent gem that I should be using for this? Thoughts on how to get this data through ruby / rails?
Thanks in advance!
Scraping Google SERP is not allowed by Google long time ago. They use every methods to stop this kind of actions. There were lots of tools before in different programming languages but none of them could last long. Some tools installed on personal computer could be used but not very stable.
Also, as I knew one years ago, there is no API available for such querying.
I suggest you give up this idea to collect rank data. It's not wise to fight against Google.

What is the best way to implement a "Find a Store" feature in Rails?

I will be implementing a search feature on a project to allow a user to find the nearest store based on driving time given a input physical address. I would prefer showing a Google maps of the closest dealers. I am using PostgreSQL 8.4.x with Rails 2.1. Can anyone recommend a good solution (Ruby gem, Maps API such Google, PostGIS database, etc)? Thanks, Chirag
I generally use Geokit:
https://github.com/andre/geokit-gem
Or Geokit Rails 3:
https://github.com/jlecour/geokit-rails3
Then of course, I use my gem gmaps4rails
Haven't really done anything like that before, but these resources should be quite useful :
http://ym4r.rubyforge.org/tutorial_ym4r_georuby.html
https://github.com/apneadiving/Google-Maps-for-Rails

Rails geocoding gems

I've used GeoKit and acts_as_geocodable in the past. I like GeoKit, but its missing nicer features like named_scopes. I'm not a huge fan of acts_as_geocodable because it duplicates address data into its own table.
Lately, these gems seem under-maintained.
What are some actively maintained gems out there?
I maintain the Geocoder gem:
http://rubygems.org/gems/geocoder
Source code:
http://github.com/alexreisner/geocoder
I can tell you it's actively maintained because I'm working on Rails 3 compatibility as I write this! It's designed to be very simple, while providing the most commonly-used geocoding features. It provides named scopes and doesn't duplicate any data.
Plugin version of geocoder is working great for me. Note that you have to rename "scope" to "named_scope" to get it to work in anything less than rails 3.
There is a 'geokit-rails3' gem can also do geocoding and reverse geocoding:
https://github.com/jlecour/geokit-rails3
It provide multiple geocoders like GoogleGeocoder and YahooGeocoder, So you can choose the most proper one according to your which map you are rendering.

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.
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"
I've used the YM4R, Georuby and spatial adapter gems with good results before.
see this description.
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.
As of December 2021, I recommend this method https://www.driftingruby.com/episodes/google-maps-api-with-stimulusjs that uses Stimulus.js
A few bits must be updated for Rails 7.
You don't need to do rails webpacker:install:stimulus, its already included via Hotwire
rename turbolinks to turbo
packs/application.js no longer exists, I have yet to find the best location for this. for now I put it in app/javascripts/controllers/index.js
import { Controller} from "stimulus" has become import { Controller } from "#hotwired/stimulus"
That's it

Resources