[OSM-dev] openstreetmap could start at user's approximate location using geo-ip

Tom Hughes tom at compton.nu
Sun Jan 18 17:22:06 GMT 2009


Sascha Silbe wrote:
> On Sun, Jan 18, 2009 at 03:34:14PM +0000, Tom Hughes wrote:
> 
>> It uses the cookie first, then your home location (assuming you're 
>> logged in), then GeoIP via hostip.info, and finally defaults to Europe.
>> Take a look at www.hostip.info if you want to see where it thinks you 
>> are.
> hostip.info locates me at Stuttgart, Germany, but OSM shows Europe 
> centered on UK. Cookies, cache and proxy disabled for testing.

Looks like geonames is being very slow at the moment, so we are probably 
timing out and giving up.

Basically the GeoLocation we do is a two step process. First we query 
hostip like this:

   http://api.hostip.info/country.php?ip=<ip-addresss>

then we feed the country code we get from that to geonames:

   http://ws.geonames.org/countryInfo?country=<country-code>

to get a bounding box for the country which we zoom the map to.

If either query gives no result, or the whole thing takes more than four 
seconds, then we give up and use the default.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list