1.調(diào)用高德地圖
(1)第一種方式:
AMapRouteConfig *config = [AMapRouteConfig new];
config.appName = [self getApplicationName];
config.appScheme = [self getApplicationScheme];
config.startCoordinate = AMapCoordinateConvert( CLLocationCoordinate2DMake(_locService.userLocation.location.coordinate.latitude, _locService.userLocation.location.coordinate.longitude), AMapCoordinateTypeBaidu);
config.destinationCoordinate = AMapCoordinateConvert(CLLocationCoordinate2DMake([_model.latitude doubleValue], [_model.longitude doubleValue]), AMapCoordinateTypeBaidu);
config.routeType = AMapRouteSearchTypeWalking;
if (![AMapURLSearch openAMapRouteSearch:config]) {
[Tool MBProgressHUDWithTitle:@"沒安裝高德地圖" OffsetY:kScreenWidth / 3 DelayTime:1.0f];
}
(2)第二種方式
// m 駕車:0:速度最快,1:費(fèi)用最少,2:距離最短姆怪,3:不走高速没龙,4:躲避擁堵拨黔,5:不走高速且避免收費(fèi)刻两,6:不走高速且躲避擁堵扩灯,7:躲避收費(fèi)和擁堵,8:不走高速躲避收費(fèi)和擁堵 公交:0:最快捷漏隐,2:最少換乘,3:最少步行奴迅,5:不乘地鐵 青责,7:只坐地鐵 ,8:時間短 是
// t = 0:駕車 =1:公交 =2:步行
NSString *url = [[NSString stringWithFormat:@"iosamap://path?sourceApplication=applicationName&sid=BGVIS1&slat=%f&slon=%f&sname=%@&did=BGVIS2&dlat=%f&dlon=%f&dname=%@&dev=0&m=0&t=0",_locService.userLocation.location.coordinate.latitude, _locService.userLocation.location.coordinate.longitude, handleHelper.address, [_model.latitude doubleValue], [_model.longitude doubleValue],_model.address] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
if ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
else
{
[Tool MBProgressHUDWithTitle:@"沒安裝高德地圖" OffsetY:kScreenWidth / 3 DelayTime:1.0f];
}