|
@ -12,17 +12,18 @@ import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 代码中不要出现main的测试代码,一个微服务进来
|
|
|
* 如果需要写测试代码就用Test的方式创建测试样例。
|
|
|
*
|
|
|
* @author l4qiang
|
|
|
*/
|
|
|
public class LatitudeUtils {
|
|
|
|
|
|
|
|
|
public static final String KEY_1 = "7d9fbeb43e975cd1e9477a7e5d5e192a";
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 返回输入地址的经纬度坐标
|
|
|
* key lng(经度),lat(纬度)
|
|
|
*/
|
|
|
public static Map<String, String> getGeocoderLatitude(String address) {
|
|
|
public static Map<String, String> getGeoCode(String address) {
|
|
|
BufferedReader in = null;
|
|
|
try {
|
|
|
//将地址转换成utf-8的16进制
|
|
@ -62,16 +63,4 @@ public class LatitudeUtils {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public static void main(String args[]) {
|
|
|
try {
|
|
|
Map<String, String> json = LatitudeUtils.getGeocoderLatitude("厦门市湖里区海天路");
|
|
|
System.out.println("经度 : " + json.get("lng"));
|
|
|
System.out.println("纬度 : " + json.get("lat"));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|