alexreisner/geocoder — Issue #181: IP address lookup
Author: amnesia7
Created: 2012-02-15 22:07:52+00:00
State: open

Hi,

I'm just starting an app that will display results in proximity order to users and would like to use the IP address lookup as a starting point for users visiting the page so that it has a stab at roughly where they are.

Since users could bookmark the actual results/display page in my app; is it ok that a user could come back to the page and Geocoder would lookup the IP address -> lat,lng for the user and be able to output results all in one request?

Would the IP address lookup need to be in a before_filter or am I ok to just put the [result.latitude, result.longitude] directly in my call to the model using the near() method?

Has anyone got an example of a method that adds the lat,lng to a cookie/session like geokit does rather than hitting the freegeoip API each page load? Or does the gem take care of that anyway?

How stable is freegeoip lookup?
Is there a fallback available to more-or-less guarantee that a lat,lng would be available straight away if freegeoip ?

I don't know if this is any use or not but I just thought I would share a link I found the other day in case it is of any use (see the Google jsapi shim section : http://msdn.microsoft.com/en-us/magazine/hh580735.aspx).

If I can load results straight away, consistently, using the IP address lookup but I wanted to offer the ability to use html5 geolocation where available can anyone offer any advice on how best to implement this mix since the IP address lookup would be done on the server but the html5 would be at the client, after they had received a set of results which I assume would mean another roundtrip to the server for the new set of results.