1. 程式人生 > >根據gps經緯度查詢地點

根據gps經緯度查詢地點

String lat = "24.26979";
        String log = "102.22431";
        String urll = "http://gc.ditu.aliyun.com/regeocoding?l=" + lat + "," + log + "&type=010";
        URL url = new URL(urll);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setDoOutput(true);
        conn.setRequestMethod("POST");
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String s = null;
        StringBuilder ss =  new StringBuilder();
        while ((s = bufferedReader.readLine()) != null) {
            ss.append(s).append("--");
        }
        bufferedReader.close();
        System.out.println(ss.toString());

這裡用的阿里雲的