- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要将 iso-3166-1/iso-3166-2 代码转换为经度/纬度
例子:
我一直在四处搜索,但没有找到完整的 list ,或者理想情况下,没有找到执行此操作的 Java 库。
This Github project很有前途,但缺少许多地区的大量地理定位信息。
请注意,与问题 Need a list of all countries in the world, with a longitude and latitude coordinate 不同,这个指的是区域分割(iso-3166-2)。
最佳答案
由于我没有得到任何答案,我将解释我是如何解决的。
我找到了 iso-3166-1 国家代码质心的 csv 列表:http://dev.maxmind.com/geoip/legacy/codes/country_latlon/ (我不得不进行一些手动调整)
至于 iso-3166-2 区域质心,我最终创建了一个 shell 脚本,它使用 Google Maps API 以 csv 格式打印区域质心(请注意,我没有验证完整输出,但我的情况检查是正确的)。这是使用 curl 的脚本的简化版本和 jq处理 API 的输出:
#!/bin/bash
# Example list of regions (full list can be obtained from https://www.ip2location.com/free/iso3166-2 )
REGIONS="VE-O GB-BKM GB-CAM GB-CMA"
for REGION in $REGIONS; do
LATLON=$(curl -s "maps.googleapis.com/maps/api/geocode/json?sensor=false&address=$REGION" | jq -r '.results[0].geometry.location.lat,@text ",",.results[0].geometry.location.lng')
echo $REGION , $LATLON | tr -d ' '
done
然后我使用 Apache Commons CSV 在我的 java 代码中导入 csv 列表
关于java - 国家/地区代码 (iso-3166-1/iso-3166-2) 到经度和纬度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28794252/
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
在我的 MVC 应用程序中,我想显示用户访问网站的国家/地区、地区和城市。我怎样才能获取它们? 最佳答案 有几种方法。一种是要求用户与远程服务器共享他的位置。 https://developer.mo
有人知道Firebase电话身份验证是否适用于印度电话号码吗? 我成功实现并使用了美国号码(+1xxxxxxxxxx),但是尝试使用印度电话号码时未收到文本。不确定是否无法正常工作,或者我丢失了某些东
我想知道网站的原始国家/地区。我注意到Alexa网站通常可以检测网站的原始国家/地区。例如,Alexa可以检测到stackoverflow.com网站的原始国家/地区是美国,依此类推。 Alexa如何
我有一些文本,其中可能包含也可能不包含国家/地区名称。例如: ' Nigeria: Hotspot Network LTD Rural Telephony Feasibility Study' 这就是
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭10 年前。 Improve th
我有一组值,它们是我的 ajax 调用中的国家/地区代码 Handler.getCountryIdparam1, {callback:function(data){ // data will
我在我的应用程序中使用谷歌地点。一切正常,但我只想从输入中删除或忽略国家/地区。 例如,如果输入“arc”我有 Arcachon, France Arcueil, France Archamps, F
在 firebase 中创建项目时,我错误地选择了错误的国家/地区。 正如您在这里看到的: 这个问题可以解决吗? (我知道项目 ID 无法更改,而且我喜欢我选择的 ID...) 最佳答案 如the d
我有一个名为“Login”的Hive表。它包含以下列: UserID | UserName | UserIP | UserCountry | Date 在特定的一天(当天的所有登录信息),我想找出用户
我正在使用谷歌地图和地理编码API来检索用户输入邮政编码/邮政编码后的纬度/经度,但我想将邮政编码/邮政编码限制为该用户所在的国家/地区,这样我就不会得到结果多个结果。 是否有一种方法可以使用 jqu
是否可以获得维基百科上所有有关系的国家、地区和城市的列表?我找不到任何适合此任务的 API。解析我需要的所有信息的最简单方法是什么?PS:我知道,我可以从其他数据源获取此信息。但我对维基百科感兴趣..
我正在用两种语言制作一个网站。是否可以检查用户位于哪个国家,以便我可以自动为用户切换语言?我的菜单中还有一个带有 _GET 的切换选项。我一开始有这段代码: if (isset($_GET['taal
这是我的 Firebase 数据库结构: 看起来就是这样。有国家和用户。如果用户访问过某个国家/地区,则该国家/地区将存储在该用户的“VisitedCountries”子项中。例如用户 Angelin
这个问题在这里已经有了答案: Convert latitude and longitude coordinates to country name in R (2 个回答) 关闭9年前. 我有一个带有
我目前正在开发我的第一个iOS应用(phonegap / cordova)。我想知道是否需要采取某些步骤,以使其不仅可用于德国应用程序商店(这是我的语言),还可以提供给国际应用程序? 最佳答案 不,你
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
背景 我目前正在开发一个向用户提问的 Android 应用程序。目前我正在创建用于提问的模块。现在我正在开发一个地形模块,它将能够向用户询问有关某个国家/地区的各种问题,并向他们显示。 问题 对于本模
我正在使用 Cloudera 的 TwitterSource for Flume。我想按国家/地区获取具有某些关键字的推文。当我想获取来自荷兰的推文时,我不知道该与什么进行比较。我有以下结果,但没有任
大多数 Web 应用程序都有一个位置字段,用户可以在其中输入自己选择的位置。 如何根据输入的位置将用户分类到不同的国家/地区。 例如,我使用了 users.xml 的 Stack Overflow 转
我是一名优秀的程序员,十分优秀!