/**
* @author 距离计算
*
*/
public class DistanceUtil {
private static final String showLocationUrl = "http://api.map.baidu.com/geocoder/v2/?output=json&ak=RguGdBfvanKG10lrLHtUAtka&address=";
private static final String waypointsDistanceUrl = "http://api.map.baidu.com/telematics/v3/distance?output=json&ak=RguGdBfvanKG10lrLHtUAtka&waypoints=";
@SuppressWarnings("unchecked")
public static Double twoCitysDistance(String startCityName, String endCityName){
Double distance = 0.00;
Map<String, Object> startShowLocation = JsoupTool.getJson(showLocationUrl+startCityName, null);
Map<String, Object> startResultLocation = (Map<String, Object>) startShowLocation.get("result");
Map<String, Object> startLocation = (Map<String, Object>) startResultLocation.get("location");
String startLng = startLocatio
用百度地图api计算两个地方的距离
最新推荐文章于 2024-04-24 16:13:50 发布