com.baidu.mapapi.search.geocode.ReverseGeoCodeResult Java Examples
The following examples show how to use
com.baidu.mapapi.search.geocode.ReverseGeoCodeResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddressEditDelegate.java From FastWaiMai with MIT License | 5 votes |
private void initGeoCoder() { mGeoCoder = GeoCoder.newInstance(); mGeoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() { @Override public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) { } @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { if (poiInfoListForGeoCoder != null) { poiInfoListForGeoCoder.clear(); } if (reverseGeoCodeResult.error.equals(SearchResult.ERRORNO.NO_ERROR)) { //获取城市 ReverseGeoCodeResult.AddressComponent addressComponent = reverseGeoCodeResult.getAddressDetail(); cityName = addressComponent.city; mTvCurrrentCity.setText(cityName); //获取poi列表 if (reverseGeoCodeResult.getPoiList() != null) { poiInfoListForGeoCoder = reverseGeoCodeResult.getPoiList(); } } else { Toast.makeText(getContext(), "该位置范围内无信息", Toast.LENGTH_SHORT).show(); } initGeoCoderListView(); } }); }
Example #2
Source File: LocationDelegate.java From FastWaiMai with MIT License | 5 votes |
private void initGeoCoder() { mGeoCoder = GeoCoder.newInstance(); mGeoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() { //地理编码检索监听器 @Override public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) { } //逆地理编码检索监听器 @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { if (poiInfoListForGeoCoder != null) { poiInfoListForGeoCoder.clear(); } if (reverseGeoCodeResult.error.equals(SearchResult.ERRORNO.NO_ERROR)) { //获取城市 ReverseGeoCodeResult.AddressComponent addressComponent = reverseGeoCodeResult.getAddressDetail(); cityName = addressComponent.city; //获取poi列表 if (reverseGeoCodeResult.getPoiList() != null) { poiInfoListForGeoCoder = reverseGeoCodeResult.getPoiList(); } } initGeoCoderListView(); } }); }
Example #3
Source File: MainActivity.java From BaiDuMapSelectDemo with Apache License 2.0 | 5 votes |
/** * 反向地理解析,结果中含有poi信息,用于刚进入地图和移动地图时使用 */ private void initGeoCoder() { mGeoCoder = GeoCoder.newInstance(); mGeoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() { @Override public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) { } @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { if (poiInfoListForGeoCoder != null) { poiInfoListForGeoCoder.clear(); } if (reverseGeoCodeResult.error.equals(SearchResult.ERRORNO.NO_ERROR)) { //获取城市 ReverseGeoCodeResult.AddressComponent addressComponent = reverseGeoCodeResult.getAddressDetail(); cityName = addressComponent.city; tv_city.setText(cityName); //获取poi列表 if (reverseGeoCodeResult.getPoiList() != null) { poiInfoListForGeoCoder = reverseGeoCodeResult.getPoiList(); } } else { Toast.makeText(mContext, "该位置范围内无信息", Toast.LENGTH_SHORT); } initGeoCoderListView(); } }); }
Example #4
Source File: MapPickerActivity.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) { if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) { // 没有找到检索结果 status.setText(R.string.picker_internalerror); status.setVisibility(View.VISIBLE); } // 获取反向地理编码结果 else { status.setVisibility(View.GONE); // 当前位置信息 mLoactionLatLng = result.getLocation(); mAddress = result.getAddress(); mName = result.getAddressDetail().street; mStreet = result.getAddressDetail().street; mCity = result.getAddressDetail().city; //滑动地图.中间位置坐标记录下来发送.相当于默认点击了一下listView中的第一条 mLatitude = result.getLocation().latitude; mLongitude = result.getLocation().longitude; mCurentInfo = new PoiInfo(); mCurentInfo.address = result.getAddress(); mCurentInfo.location = result.getLocation(); mCurentInfo.name = "[当前位置]"; mInfoList.clear(); mInfoList.add(mCurentInfo); // 将周边信息加入表 if (result.getPoiList() != null) { mInfoList.addAll(result.getPoiList()); } mAdapter.setNotifyTip(0); // 通知适配数据已改变 mAdapter.notifyDataSetChanged(); loading.setVisibility(View.GONE); } }
Example #5
Source File: GeoCoderListener.java From VirtualLocation with Apache License 2.0 | 5 votes |
/** * 搜索(根据坐标-->实地信息) * @param result */ @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) { if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) { Toast.makeText(mContext, "抱歉,未能找到结果", Toast.LENGTH_LONG).show(); return; } mLocationTip.setText(String.format("伪造位置:%s", result.getAddress())); }
Example #6
Source File: GeolocationModule.java From react-native-baidu-map with MIT License | 5 votes |
@Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) { WritableMap params = Arguments.createMap(); if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) { params.putInt("errcode", -1); } else { ReverseGeoCodeResult.AddressComponent addressComponent = result.getAddressDetail(); params.putString("address", result.getAddress()); params.putString("province", addressComponent.province); params.putString("city", addressComponent.city); params.putString("district", addressComponent.district); params.putString("street", addressComponent.street); params.putString("streetNumber", addressComponent.streetNumber); WritableArray list = Arguments.createArray(); List<PoiInfo> poiList = result.getPoiList(); for (PoiInfo info: poiList) { WritableMap attr = Arguments.createMap(); attr.putString("name", info.name); attr.putString("address", info.address); attr.putString("city", info.city); attr.putDouble("latitude", info.location.latitude); attr.putDouble("longitude", info.location.longitude); list.pushMap(attr); } params.putArray("poiList", list); } sendEvent("onGetReverseGeoCodeResult", params); }
Example #7
Source File: LocationActivity.java From Conquer with Apache License 2.0 | 5 votes |
@Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) { if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) { T.show(context, "抱歉,未能找到结果"); return; } BmobLog.i("反编码得到的地址:" + result.getAddress()); lastLocation.setAddrStr(result.getAddress()); }
Example #8
Source File: NaviSetPointPresenter.java From AssistantBySDK with Apache License 2.0 | 4 votes |
@Override public void initStartAddress() { BDLocation location = new BDLocation(); location.setLatitude(address.getLatitude()); location.setLongitude(address.getLongitude()); location.setRadius(address.getRadius()); location.setSpeed(address.getSpeed()); location.setSatelliteNumber(address.getSatelliteNumber()); // location = LocationClient.getBDLocationInCoorType(location, BDLocation.BDLOCATION_GCJ02_TO_BD09LL); //更新家和公司视图 updateCompany(); updateHome(); final GeoCoder geoCoder = GeoCoder.newInstance(); /* 设置地理编码查询监听者 */ final BDLocation finalLocation = location; geoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() { @Override public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) { } @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult r) { List<PoiInfo> ls = r.getPoiList(); if (ls != null && ls.size() > 0) { initAddress = new BaiduAddress(); // String myLocation; setBaiduAddressFromPoiInfo(initAddress, ls.get(0)); // myLocation = initAddress.getName(); initAddress.setAddress(address.getAddressDetail()); initAddress.setLatitude(finalLocation.getLatitude()); initAddress.setLongitude(finalLocation.getLongitude()); if (TextUtils.isEmpty(initAddress.getCity())) initAddress.setCity(address.getCity()); BaiduAddress myStartAddr = new BaiduAddress(); myStartAddr.setLatitude(initAddress.getLatitude()); myStartAddr.setLongitude(initAddress.getLongitude()); myStartAddr.setName("我的位置" + "(" + initAddress.getName() + ")" + "附近"); if (mSetPointView.getStartAddrText().startsWith("我的位置")) { myStartAddr.setRemark("出发地"); myStartAddr.setId(null); myStartAddr.setFavoritedTime(null); mAppConfig.startAddress = myStartAddr; } //设置默认回家和去公司的出发地址 // mAppConfig.myAddress = myLocation; // updateCompany(); // updateHome(); //由init进入该方法时不触发导航 updateStart(false); updateEnd(false); updateHistoryList(); geoCoder.destroy(); } } }); geoCoder.reverseGeoCode(new ReverseGeoCodeOption(). location(new LatLng(location.getLatitude(), location.getLongitude()))); }
Example #9
Source File: FakeWeiBoActivity.java From AndroidAnimationExercise with Apache License 2.0 | 4 votes |
private void initLocationAndSearch() { //location mLocationClient = new LocationClient(getApplicationContext()); //声明LocationClient类 mLocationClient.registerLocationListener(this); //注册监听函数 LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy );//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系 int span = 1000; option.setScanSpan(span);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的 option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要 option.setOpenGps(true);//可选,默认false,设置是否使用gps option.setLocationNotify(true);//可选,默认false,设置是否当GPS有效时按照1S/1次频率输出GPS结果 option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近” option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到 option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死 option.SetIgnoreCacheException(false);//可选,默认false,设置是否收集CRASH信息,默认收集 option.setEnableSimulateGps(false);//可选,默认false,设置是否需要过滤GPS仿真结果,默认需要 mLocationClient.setLocOption(option); //search mPoiSearch = PoiSearch.newInstance(); mPoiSearch.setOnGetPoiSearchResultListener(new MyPoiSearchListener()); mNearbySearchOption = new PoiNearbySearchOption() .radius(5000) .pageNum(1) .pageCapacity(20) .sortType(PoiSortType.distance_from_near_to_far); //////////////// mGeoCoder = GeoCoder.newInstance(); mGeoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() { @Override public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) { Log.e(TAG, "onGetGeoCodeResult: " + geoCodeResult.toString()); } @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { Log.e(TAG, "onGetReverseGeoCodeResult: " + reverseGeoCodeResult.toString()); } }); }
Example #10
Source File: MapFragment.java From MapForTour with MIT License | 4 votes |
@Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { Log.d("lml", "获取地址反编码信息成功"); tvAddOverlayGeoCoder.setText(reverseGeoCodeResult.getAddress()); }
Example #11
Source File: NavigationActivity.java From BaiduMap-TrafficAssistant with MIT License | 4 votes |
@Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult arg0) { // TODO Auto-generated method stub }
Example #12
Source File: MainActivity.java From MoveMapLocation with Apache License 2.0 | 4 votes |
@Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { List<PoiInfo> poiInfos = reverseGeoCodeResult.getPoiList(); PoiAdapter poiAdapter = new PoiAdapter(MainActivity.this, poiInfos); poisLL.setAdapter(poiAdapter); }