当我有国家名称/ ISO与Android时获取纬度/经度坐标

时间:2016-07-29 21:04:06

标签: android google-maps-api-3 coordinates country-codes

在Android中,我有国家的ISO代码。 我想从该国家获得纬度/经度坐标。

我正在使用Google Maps API。

我如何获得坐标?

1 个答案:

答案 0 :(得分:2)

AFAIK Google地图中没有API。

但你可以使用:https://developers.google.com/public-data/docs/canonical/countries_csv

您可以使用这些值创建HashMap。

Map<String, LatLng> countries = new HashMap<String, LatLng>();

countries.put("PL", new LatLng(51.919438, 19.145136));

稍后您可以像这样使用它:

countries.get("PL"); // returns LatLng(51.919438, 19.145136)