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 shipped a productivity SaaS in 30 days as a solo dev — here's what AI actually changed (and what it didn't) User Avatar 281 comments 85% of visitors leave our pricing page without buying. sharing our raw funnel data User Avatar 48 comments I built a tool that shows what a contract could cost you before signing User Avatar 45 comments Are indie makers actually bad customers? User Avatar 42 comments I Found Blue Ocean in the Most Crowded Market on the Internet User Avatar 39 comments Tech is done. Marketing is hard. Is a 6-month free period a valid growth hack? User Avatar 27 comments