3
16 Comments

Best way to to lookup geolocation from IP address

Hello,

I have been wanting to access a location based on an ip address.
There exists third party tools that provide an api like https://ipinfo.io and https://ipapi.com.

Have you ever had the need to look up an ip address? If so I was wondering what you used? Do you use a third party tool or maybe you looked in local database?

posted to Icon for group Developers
Developers
on June 25, 2020
  1. 3

    dbip offers free version of the database (https://db-ip.com/db/lite.php) and there are geoip packages to read those databases in different languages.

    For example here is the python package https://pypi.org/project/geoip2/

    1. 2

      +1 for db-ip.com, their free license is better as MaxMind's GeoLite terms were recently updated for the worse.

    2. 1

      I thought the geoip2 package was build on GeoIP2 - https://dev.maxmind.com/geoip/

      It's also the GeoIP using by Django - https://docs.djangoproject.com/en/3.0/ref/contrib/gis/geoip2/

      1. 1

        dbip offers the same database format (MMDB) as maxmind, so it's compatible.

        I've been using those free files and geoip2 in both Django and command-line tools to parse access logs.

        1. 1

          Oh cool thanks. I'll take a look at dbip next time I want to get it working. I didn't quite realise you could swap out the db that way.

  2. 2

    I used https://ipstack.com/ to lookup the location. I don't think there exists a local database for that.

    1. 1

      Cool!
      There are some free GeoIP databases that you can download. At least I see people talking about them on the web XD. But the drawback here is that they can be outdated and you have to update them.

  3. 1

    We ended up building our own micro service using a cloud function

  4. 1

    Thanks for all the great answers. For now I used a free database from Maxmind. However down the line I might end up using a paid solution.

  5. 1

    You can use the free geolocation databases from MaxMind https://dev.maxmind.com/geoip/geoip2/geolite2/

  6. 1

    I have used ipinfo.io to get the IP and then pass that to https://geo.ipify.org/ to get the location. The APIs are pretty easy to use.

  7. 1

    GeoIP2 - https://dev.maxmind.com/geoip/

    It can be downloaded as a csv or downloadable databases with APIs in a large number of different programming languages - https://dev.maxmind.com/geoip/geoip2/downloadable/

    Edit:

    See @poitch's comment, db-ip.com is also a good option for python.

  8. 1

    I built my own after I found a non-profit site that accidentally listed their API publically. But after a few months, they patched it causing me to ask the same questions you are asking.

    Initially, I looked into how to get this up and running by looking for internet registry databases, like RIPE, and although some have full, frequently updated databases, it was expensive and would have required a lot of setup. And at the time we need a replacement solution fast!

    So I eventually settled upon using http://geoipify.com for Knoma instead. They are a fairly new player and they have been great for the month we have been using them.

  9. 0

    I've used a server based solution and https://ip-api.com/ (via Javascript). I prefer https://ip-api.com for browser based lookups. We've used them at high volume with no issues for 3 years now.

  10. 1

    This comment was deleted 6 years ago.

Trending on Indie Hackers
I'm a lawyer who launched an AI contract tool on Product Hunt today — here's what building it as a non-technical founder actually felt like User Avatar 142 comments “This contract looked normal - but could cost millions” User Avatar 54 comments 👉 The most expensive contract mistakes don’t feel risky User Avatar 41 comments The indie maker's dilemma: 2 months in, 700 downloads, and I'm stuck User Avatar 39 comments A simple way to keep AI automations from making bad decisions User Avatar 36 comments I spent weeks building a food decision tool instead of something useful User Avatar 28 comments