package main;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
* @author Fairy
* 2019/01/21 4:45:40
* 调用高德相关API
*/
public class MapUtil {
//个人key
private static final String KEY = "e4f125cb287f912d447b07d1445e06df";
//API前缀
private static final String BASE_PATH = "http://restapi.amap.com/v3";
public static void main(String[] args) {
//1.计算两个经纬度之间的距离
String origin = "104.043390" + "," + "30.641982"; // 格式:经度,纬度;注意:高德最多取小数点后六位
String target = "106.655347" + "," + "31.786691";
String distance = distance(origin, target);
System.out.println("原坐标:{&
高德API相关调用(计算两个经纬度之间的距离、坐标转换、地址与经纬度的转换)
最新推荐文章于 2024-06-29 18:29:18 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)