feiyu02
13 小时以前 4a976d3763be8a7bed743faf24abf2718ae18e31
src/main/kotlin/com/flightfeather/uav/common/net/AMapService.kt
@@ -88,11 +88,15 @@
    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,
@@ -105,7 +109,7 @@
                a["streetNumber"].asJsonObject["street"].asString,
            )
        } catch (e: Exception) {
            throw BizException("高德API坐标转换错误,${e.message}")
            throw BizException("高德API坐标转换错误,${e.message}", e.cause)
        }
    }