Andriod通过经纬度解析实际地址
来源:互联网 发布:用ps淘宝详情页怎么做 编辑:程序博客网 时间:2024/04/19 06:31
public static String getAddress(double latitude, double longitude){String address = "";String url = "http://maps.google.cn/maps/api/geocode/json?latlng=" + latitude + "," + longitude + "&sensor=true,language=zh-CN";JSONObject obj = httpGet(url);try {if (obj.getString("status").equals("OK")){JSONArray ja = JSON.parseArray(obj.getString("results"));JSONObject jo = JSON.parseObject(ja.getString(0));address = jo.getString("formatted_address");}} catch (JSONException e) {e.printStackTrace();}return address;}
得到的结果是
{ "results" : [ { "address_components" : [ { "long_name" : "三星河西路", "short_name" : "三星河西路", "types" : [ "route" ] }, { "long_name" : "启东市", "short_name" : "启东市", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "南通市", "short_name" : "南通市", "types" : [ "locality", "political" ] }, { "long_name" : "江苏省", "short_name" : "江苏省", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "中国", "short_name" : "CN", "types" : [ "country", "political" ] } ], "formatted_address" : "中国江苏省南通市启东市三星河西路", "geometry" : { "bounds" : { "northeast" : { "lat" : 31.80471519999999, "lng" : 121.5974265 }, "southwest" : { "lat" : 31.8010305, "lng" : 121.5947618 } }, "location" : { "lat" : 31.8028837, "lng" : 121.5960734 }, "location_type" : "GEOMETRIC_CENTER", "viewport" : { "northeast" : { "lat" : 31.80471519999999, "lng" : 121.5974431302915 }, "southwest" : { "lat" : 31.8010305, "lng" : 121.5947451697085 } } }, "place_id" : "ChIJp4KxuQ_9sTURgjlmYR-EVdk", "types" : [ "route" ] }, { "address_components" : [ { "long_name" : "启东市", "short_name" : "启东市", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "南通市", "short_name" : "南通市", "types" : [ "locality", "political" ] }, { "long_name" : "江苏省", "short_name" : "江苏省", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "中国", "short_name" : "CN", "types" : [ "country", "political" ] } ], "formatted_address" : "中国江苏省南通市启东市", "geometry" : { "bounds" : { "northeast" : { "lat" : 32.1230276, "lng" : 121.9751853 }, "southwest" : { "lat" : 31.6170391, "lng" : 121.4314881 } }, "location" : { "lat" : 31.793278, "lng" : 121.655432 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 32.1230276, "lng" : 121.9751853 }, "southwest" : { "lat" : 31.6170391, "lng" : 121.4314881 } } }, "place_id" : "ChIJe2KEZhUcrjURttkD8epMbU4", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "address_components" : [ { "long_name" : "南通市", "short_name" : "南通市", "types" : [ "locality", "political" ] }, { "long_name" : "江苏省", "short_name" : "江苏省", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "中国", "short_name" : "CN", "types" : [ "country", "political" ] } ], "formatted_address" : "中国江苏省南通市", "geometry" : { "bounds" : { "northeast" : { "lat" : 32.7111345, "lng" : 121.9751853 }, "southwest" : { "lat" : 31.6170391, "lng" : 120.2023156 } }, "location" : { "lat" : 31.980171, "lng" : 120.894291 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 32.1232631, "lng" : 121.0250473 }, "southwest" : { "lat" : 31.9006504, "lng" : 120.7256162 } } }, "place_id" : "ChIJC-ohLkd4sTURVqJkkGIKJZY", "types" : [ "locality", "political" ] }, { "address_components" : [ { "long_name" : "江苏省", "short_name" : "江苏省", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "中国", "short_name" : "CN", "types" : [ "country", "political" ] } ], "formatted_address" : "中国江苏省", "geometry" : { "bounds" : { "northeast" : { "lat" : 35.1245133, "lng" : 121.9751853 }, "southwest" : { "lat" : 30.7578404, "lng" : 116.3619603 } }, "location" : { "lat" : 33.1401715, "lng" : 119.7889248 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 35.124353, "lng" : 121.962778 }, "southwest" : { "lat" : 30.7578404, "lng" : 116.3619603 } } }, "place_id" : "ChIJRcJLMdoAtzURtVOFbLbqlI0", "types" : [ "administrative_area_level_1", "political" ] }, { "address_components" : [ { "long_name" : "中国", "short_name" : "CN", "types" : [ "country", "political" ] } ], "formatted_address" : "中国", "geometry" : { "bounds" : { "northeast" : { "lat" : 53.56097399999999, "lng" : 134.7728099 }, "southwest" : { "lat" : 17.9996, "lng" : 73.4994136 } }, "location" : { "lat" : 35.86166, "lng" : 104.195397 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 53.56097399999999, "lng" : 134.7726951 }, "southwest" : { "lat" : 18.1618062, "lng" : 73.5034261 } } }, "place_id" : "ChIJwULG5WSOUDERbzafNHyqHZU", "types" : [ "country", "political" ] } ], "status" : "OK"}
阅读全文
1 0
- Andriod通过经纬度解析实际地址
- 通过经纬度解析出地址
- java通过百度地图把实际地址转换为经纬度
- java通过百度地图把实际地址转换为经纬度
- IOS通过经纬度反向解析地址
- 经纬度获取地址/地址解析经纬度
- 通过经纬度获取地址信息
- 百度通过经纬度获取地址
- 百度地图的反地址解析(通过经纬度查询地址信息)
- ios 定位经纬度 地址解析
- 根据经纬度反地址解析
- 经纬度解析地址传到后台
- IOS通过经纬度进行反向地址解析(有些方法虽然过时了,但是依然很好用!)
- java程序调用百度Geocoding API逆地址解析通过经纬度查询位置
- C#根据经纬度请求返回坐标实际地址
- 如何通过经纬度获取地址信息?
- android 通过经纬度获取地址信息
- 如何通过经纬度获取地址信息?
- 欢迎使用CSDN-markdown编辑器
- 异常Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy
- AutoCompeleteTestView--动态自动匹配输入的内容
- 由中间向两边渐变的分割线
- 应用间的数据接收和发送
- Andriod通过经纬度解析实际地址
- MySQL监控利器-Innotop
- Git中三种文件状态及其转换
- 上传工具类
- Scala学习笔记系列<1>
- Instant Run使用要注意的坑
- 39. Combination Sum
- 使用IntelliJ IDEA开发SpringMVC网站(四)用户管理
- oracle 创建 dblink