根據經緯度取地址 高德、百度
系統自帶的方法:
//根據經緯度解析成位置
- CLGeocoder *geocoder=[[[CLGeocoder alloc]init]autorelease];
- [geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemark,NSError *error)
- {
- CLPlacemark *mark=[placemark objectAtIndex:0];
-
[email protected]"沒有當前位置的詳細資訊";
- [email protected]"詳細資訊請點選‘附近’檢視";
- place.title=[NSString stringWithFormat:@"%@%@%@",mark.subLocality,mark.thoroughfare,mark.subThoroughfare];
- place.subTitle=[NSString stringWithFormat:@"%@",mark.name];//獲取subtitle的資訊
-
[self.myMapView selectAnnotation:place animated:YES];
- } ];
// 百度地圖反編譯
-(void)mapViewWillStartLocatingUser:(BMKMapView *)mapView{
NSLog(@"開始定位");
}
/**
*使用者位置更新後,會呼叫此函式
*@param mapView 地圖View
*@param userLocation 新的使用者位置
*/
-(void)mapView:(BMKMapView *)mapView didUpdateUserLocation:(BMKUserLocation *)userLocation{
NSLog(@"latitude--%f,longtitude---%f ",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude);
locaLatitude=userLocation.location.coordinate.latitude;//緯度
locaLongitude=userLocation.location.coordinate.longitude;//精度
BMKCoordinateRegion region;
//將定位的點居中顯示
region.center.latitude=locaLatitude;
region.center.longitude=locaLongitude;
//反地理編碼出地理位置
CLLocationCoordinate2D pt=(CLLocationCoordinate2D){0,0};
pt=(CLLocationCoordinate2D){locaLatitude,locaLongitude};
BOOL flag=[_search reverseGeocode:pt];
if (flag) {
myMapView.showsUserLocation=NO;//不顯示自己的位置
self.btnDone.enabled=YES;
}
//當前位置標註和地圖的比例(註釋為可不用)// BMKCoordinateSpan spans;// spans.latitudeDelta=0.01;// spans.longitudeDelta=0.01;// region.span=spans;
myMapView.region=region;
}
在使用 [_search reverseGeocode:pt] 的時候,會呼叫它的一個協議方法,也就是下面的方法:
//反地理編碼 -(void)onGetAddrResult:(BMKAddrInfo *)result errorCode:(int)error{ if (error==0) { BMKPointAnnotation *item=[[BMKPointAnnotation alloc] init]; item.coordinate=result.geoPt;//地理座標 item.title=result.strAddr;//地理名稱 [myMapView addAnnotation:item]; myMapView.centerCoordinate=result.geoPt; self.lalAddress.text=[result.strAddr stringByReplacingOccurrencesOfString:@"-" withString:@""]; if (![self.lalAddress.text isEqualToString:@""]) { strProvince=result.addressComponent.province;//省份 strCity=result.addressComponent.city;//城市 strDistrict=result.addressComponent.district;//地區 } // CLGeocoder *geocoder=[[CLGeocoder alloc] init];// CLGeocodeCompletionHandler handle=^(NSArray *palce,NSError *error){// for (CLPlacemark *placemark in palce) {// NSLog(@"%@1-%@2-%@3-%@4-%@5-%@6-%@7-%@8-%@9-%@10-%@11-%@12",placemark.name,placemark.thoroughfare,placemark.subThoroughfare,placemark.locality,placemark.subLocality,placemark.administrativeArea,placemark.postalCode,placemark.ISOcountryCode,placemark.country,placemark.inlandWater,placemark.ocean,placemark.areasOfInterest);// break;// }// };// CLLocation *loc = [[CLLocation alloc] initWithLatitude:locaLatitude longitude:locaLongitude];// [geocoder reverseGeocodeLocation:loc completionHandler:handle]; } }
相關推薦
根據經緯度取地址 高德、百度
系統自帶的方法: //根據經緯度解析成位置 CLGeocoder *geocoder=[[[CLGeocoder alloc]init]autorelease]; [geo
Android應用內開啟高德、百度、騰訊地圖app
最近在專案中需要地圖導航功能,但是匯入第三方地圖導航包的話,應用打出包後會很大,所以考慮到可以通過呼叫外部地圖應用來解決,參考了微信開啟外部地圖的做法,有了下面的解決辦法:1.主要思路:通過高德、百度、騰訊提供的Uri開啟應用外部地圖app.2.關鍵程式碼(以高德地
iOS 調起地圖進行導航(系統地圖、高德、百度)
主要程式碼: 1,呼叫iOS系統的apple map 1.1 首先新增相對應的庫MapKit.framework 1.2 然後匯入標頭檔案 #import <MapKit/MapKit.h
Android仿微信呼叫第三方地圖應用導航(高德、百度、騰訊)
好久沒有寫Andorid程式碼啦!最近剛好要實現一個這個功能,順便就在部落格裡分享一下。 實現目標 先來一張微信功能截圖看看要做什麼 其實就是有一個目的地,點選目的地的時候彈出可選擇的應用進行導航。 大腦動一下,要實現這個功能應該大體分成兩步:
呼叫第三方地圖導航,高德、百度、谷歌,無需引用sdk
先判斷是否存在地圖,存在就可以進入導航,沒有的話就預設進入市場下載app,程式碼如下: i1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View
如何讓高德/百度地圖的sdk直接可執行在真機上
或許大家都有遇到過在百度地圖或者是高德地圖上註冊key簽名時放置到自己的manifest中,會發現直接執行真機是會無效(地圖無法顯示/無法定位),一定要另外打包才可現實相關三方資訊,比如地圖的顯示。在這做個筆記,剛好解決了這個問題,今天要講的
4.08關於高德和百度定位的選擇
問題1描述:繪製軌跡時,雖然有getAlatitude方法,但是獲取到的高程為0,導致進行顯示軌跡要素被覆蓋 解決方案:人為的設定一個高程,比如100,保證能夠正常顯示 for (int j = 0; j < routePoints.length; j++) {
高德地圖百度地圖導航座標轉換
專案中的定位商家服務搜尋用的是高德地圖,畢竟高德在地圖這塊做的比百度好(個人認為)。這裡吐槽下百度的開發平臺,上面開發文件及案例寫的真不好,想找某個問題點很難找到和定位,希望百度改善下。 高德轉百度(火星座標gcj02ll–>百度座標bd09ll)
包含高德,百度等地圖 apikey 專案打包 relese debug keystore
1.debug版, 不同編譯環境,sha1不同,需要自己提取; 在android studio terminal中輸入 keytool -list -v -keystore C:\Users\Ad
獲取高德和百度SHA1碼(釋出版和除錯版都有)
高德和百度都是一樣的 如圖下圖:需要釋出版的SHA1和除錯版的SHA1 除錯版的SHA1獲取: 在控制檯視窗C盤目錄下輸入 cd .android 定位到 .android 資料夾 除錯版使用debug.keystore(預設),命令為: keytool
高德,百度,Google地圖定位偏移以及座標系轉換
一。在進行地圖開發過程中,我們一般能接觸到以下三種類型的地圖座標系: 1.WGS-84原始座標系,一般用國際GPS紀錄儀記錄下來的經緯度,通過GPS定位拿到的原始經緯度,Google和高德地圖定位的的經緯度(國外)都是基於WGS-84座標系的;但是在國內是不允許直接用WGS
高德地圖-根據經緯度獲取地址(逆地理編碼)
2.根據經緯度得到具體地址: 1.這裡需要用到地圖搜尋SDK; 2.通過逆地理編碼來實現。 3.示例程式碼: @Override protected void o
百度、高德、Googe經緯度轉換
private static double x_pi = 3.14159265358979324 * 3000.0 / 180.0; /** * 中國正常座標系GCJ02協議的座標,轉到 百度地圖對應的 BD09 協議座標 * * @param lat * @param lng *
php 高德 根據地址獲取經緯度|| 根據 經緯度獲取地址
/** * 根據地址 獲取經緯度 * @param $address * @return mixed */ function addresstolatlag($address){ $url='http://restapi.amap.com/v3/geoco
openlayers 3加載百度、高德、google瓦片地圖
nbsp ima play sset baidumap tile target leg lin 1、加載高德地圖 //高德地圖 var AMapLayer = new ol.layer.Tile({ source: new
Android 仿微信調用第三方應用導航(百度,高德、騰訊)
detail decorview fcm onclick api 描述 log def repr 實現目標 先來一張微信功能截圖看看要做什麽 其實就是有一個目的地,點擊目的地的時候彈出可選擇的應用進行導航。 大腦動一下,要實現這個功能應該大體分成兩步: 底部彈出可選的地
百度地圖根據經緯度獲取地址
DC poi coder com res code ict UNC func var point = new BMap.Point(經度, 緯度); var gc = new BMap.Geocoder();
百度地圖api根據經緯度獲取地址的詳細信息
json indexof close 詳細信息 format read ESS clas ava package com.haiyisoft.cAssistant.mapApi; import java.io.BufferedReader; import java.io
android開啟外部地圖導航(百度、高德、騰訊)
1.參考下面的地址:我的呼叫百度的就是採用這個文章的方法 https://blog.csdn.net/hyyz3293/article/details/76836633 2,我自己採用的方法,如下; //todo:獲取當前自己的位置; getLocation(new BDLocatio
java根據經緯度獲取地址(百度地圖)
先建立HttpClientUtils工具類 package cn.crenative.lockinlife.util; import com.google.common.base.Function; import com.google.common.collect.FluentIter