Java Code Examples for com.amap.api.services.poisearch.PoiSearch#setBound()
The following examples show how to use
com.amap.api.services.poisearch.PoiSearch#setBound() .
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: PoiAroundSearchActivity.java From TraceByAmap with MIT License | 6 votes |
/** * 开始进行poi搜索 */ protected void doSearchQuery() { keyWord = mSearchText.getText().toString().trim(); currentPage = 0; query = new PoiSearch.Query(keyWord, "", "");// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国) query.setPageSize(20);// 设置每页最多返回多少条poiitem query.setPageNum(currentPage);// 设置查第一页 if (lp != null) { poiSearch = new PoiSearch(this, query); poiSearch.setOnPoiSearchListener(this); poiSearch.setBound(new SearchBound(lp, 5000, true));// // 设置搜索区域为以lp点为圆心,其周围5000米范围 poiSearch.searchPOIAsyn();// 异步搜索 } }
Example 2
Source File: LocationActivity.java From xmpp with Apache License 2.0 | 5 votes |
protected void doSearchQuery() { currentPage = 0; query = new PoiSearch.Query("", "", "");// query.setPageSize(50);// 设置每页最多返回多少条poiitem query.setPageNum(currentPage);// 设置查询页码 poiSearch = new PoiSearch(this, query);// 初始化poiSearch对象 poiSearch.setBound(new PoiSearch.SearchBound(lp, 20000)); poiSearch.setOnPoiSearchListener(this);// 设置回调数据的监听器 poiSearch.searchPOIAsyn();// 开始搜索 }
Example 3
Source File: FindMapAroundAty.java From myapplication with Apache License 2.0 | 5 votes |
/** * 开始进行poi搜索 */ protected void doSearchQuery(String keyWord, String city) { currentPage = 0; query = new PoiSearch.Query(keyWord, "", city);// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国) query.setPageSize(20);// 设置每页最多返回多少条poiitem query.setPageNum(currentPage);// 设置查第一页 if (lp != null) { poiSearch = new PoiSearch(this, query); poiSearch.setOnPoiSearchListener(this); poiSearch.setBound(new PoiSearch.SearchBound(lp, 5000, true));// // 设置搜索区域为以lp点为圆心,其周围5000米范围 poiSearch.searchPOIAsyn();// 异步搜索 } }
Example 4
Source File: SearchInteracter.java From BmapLite with GNU General Public License v3.0 | 4 votes |
private void searchPoiNearbyByAmap(MyPoiModel nearby, String keyword, int page, final OnSearchResultListener listener) { PoiSearch.Query query = new PoiSearch.Query(keyword, "", nearby.getCity()); query.setPageSize(20); query.setPageNum(page); PoiSearch.SearchBound bound = new PoiSearch.SearchBound(new LatLonPoint(nearby.getLatitude(), nearby.getLongitude()), 20000); PoiSearch poiSearchAmap = new PoiSearch(mContext, query); poiSearchAmap.setBound(bound); poiSearchAmap.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { @Override public void onPoiSearched(com.amap.api.services.poisearch.PoiResult poiResult, int code) { if (1000 == code) { if (null != poiResult && null != poiResult.getPois() && !poiResult.getPois().isEmpty()) { List<MyPoiModel> list = new ArrayList<>(); for (PoiItem poi : poiResult.getPois()) { MyPoiModel myPoi = new MyPoiModel(mType); myPoi.setCity(poi.getCityName()); myPoi.setUid(poi.getPoiId()); myPoi.setName(poi.getTitle()); myPoi.setInfo(poi.getTel()); myPoi.setAddress(poi.getSnippet()); myPoi.setLatitude(poi.getLatLonPoint().getLatitude()); myPoi.setLongitude(poi.getLatLonPoint().getLongitude()); myPoi.setTypePoi(TypePoi.POINT); list.add(myPoi); } listener.setSearchResult(list); listener.onShowData("search"); } else { listener.onNoData("search"); } } else { listener.onNoData("search"); } } @Override public void onPoiItemSearched(PoiItem poiItem, int i) { } }); poiSearchAmap.searchPOIAsyn(); }
Example 5
Source File: SearchInteracter.java From BmapLite with Apache License 2.0 | 4 votes |
private void searchPoiNearbyByAmap(MyPoiModel nearby, String keyword, int page, final OnSearchResultListener listener) { PoiSearch.Query query = new PoiSearch.Query(keyword, "", nearby.getCity()); query.setPageSize(20); query.setPageNum(page); PoiSearch.SearchBound bound = new PoiSearch.SearchBound(new LatLonPoint(nearby.getLatitude(), nearby.getLongitude()), 20000); PoiSearch poiSearchAmap = new PoiSearch(mContext, query); poiSearchAmap.setBound(bound); poiSearchAmap.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { @Override public void onPoiSearched(com.amap.api.services.poisearch.PoiResult poiResult, int code) { if (1000 == code) { if (null != poiResult && null != poiResult.getPois() && !poiResult.getPois().isEmpty()) { List<MyPoiModel> list = new ArrayList<>(); for (PoiItem poi : poiResult.getPois()) { MyPoiModel myPoi = new MyPoiModel(mType); myPoi.setCity(poi.getCityName()); myPoi.setUid(poi.getPoiId()); myPoi.setName(poi.getTitle()); myPoi.setInfo(poi.getTel()); myPoi.setAddress(poi.getSnippet()); myPoi.setLatitude(poi.getLatLonPoint().getLatitude()); myPoi.setLongitude(poi.getLatLonPoint().getLongitude()); myPoi.setTypePoi(TypePoi.POINT); list.add(myPoi); } listener.setSearchResult(list); listener.onShowData("search"); } else { listener.onNoData("search"); } } else { listener.onNoData("search"); } } @Override public void onPoiItemSearched(PoiItem poiItem, int i) { } }); poiSearchAmap.searchPOIAsyn(); }