| | |
| | | fun reGeo(location:Pair<Double, Double>):AMapAddress { |
| | | val res = httpMethod.get("/v3/geocode/regeo", listOf( |
| | | "key" to KEY, |
| | | "location" to "${location.first},${location.second}" |
| | | "location" to "${location.first},${location.second}", |
| | | "extensions" to "all" |
| | | )) |
| | | val obj = handleRes(res) |
| | | try { |
| | | val a = obj["regeocode"].asJsonObject["addressComponent"].asJsonObject |
| | | val regeocode = obj["regeocode"].asJsonObject |
| | | val a = regeocode["addressComponent"].asJsonObject |
| | | val roads = regeocode["roads"].asJsonArray |
| | | val roadinters = regeocode["roadinters"].asJsonArray |
| | | return AMapAddress( |
| | | a["country"].asString, |
| | | a["province"].asString, |
| | |
| | | a["streetNumber"].asJsonObject["street"].asString, |
| | | ) |
| | | } catch (e: Exception) { |
| | | throw BizException("高德API坐标转换错误,${e.message}") |
| | | throw BizException("高德API坐标转换错误,${e.message}", e.cause) |
| | | } |
| | | } |
| | | |