How do I use MaxMind#39;s GeoIP database to determine location?(如何使用 MaxMind 的 GeoIP 数据库来确定位置?)
问题描述
所以,我在上一个问题中被告知我可以使用 MaxMind 提供的 数据库来确定位置.
So, I was told in my previous question that I can use the databases provided by MaxMind to determine locations.
所以,我从他们的网站下载了他们的数据库.它们是 csv
文件并在 Excel 中打开.
So, I got their databases downloaded from their site. They are csv
files and open up in Excel.
InetAddress ip = InetAddress.getLocalHost()
是我获取计算机 IP 的方式.从那里我做 String justIP = ip.getHostAddress()
InetAddress ip = InetAddress.getLocalHost()
is how I get the IP of my computer. From there I do String justIP = ip.getHostAddress()
我的问题是:
justIP
解析为城市位置???我对此很陌生,因此将不胜感激.
My question is:
justIP
to a city location using the DB I just downloaded ??? I am new to this so a little help will be appreciated.
其中一个文件包含三列.startIPNum
、endIPNum
和 locID
我不知道这些是做什么的,但我猜 locID
映射到一个城市和国家在另一个文件中的位置.
One of the files has three columns. startIPNum
, endIPNum
and locID
I do not know what these do but I guess locID
maps to a city and country location in the other file.
推荐答案
你试过 Maxmind 的 Java 例子吗?http://dev.maxmind.com/geoip/downloadable#Java-8
有关字段说明,请参见 http://dev.maxmind.com/geoip/csv
Did you tried the Java examples from Maxmind? http://dev.maxmind.com/geoip/downloadable#Java-8
And see http://dev.maxmind.com/geoip/csv for field descriptions
这篇关于如何使用 MaxMind 的 GeoIP 数据库来确定位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 MaxMind 的 GeoIP 数据库来确定位置?
基础教程推荐
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 降序排序:Java Map 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01