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

Ævar Arnfjörð Bjarmason avarab at gmail.com
Sun Jan 18 22:18:22 GMT 2009


On Sun, Jan 18, 2009 at 5:22 PM, Tom Hughes <tom at compton.nu> wrote:
> 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.

I've never seen anything but the central European view even though
hostip.info recognizes me as being in Iceland, but the geonames query
seems to be taking too long:

$ time wget -O /dev/null -q http://ws.geonames.org/countryInfo?country=is
real	0m4.739s

This would work better if the geonames query was cached locally,
information about the rough boundaries of countries doesn't change
very often.




More information about the dev mailing list