第1行: | 第1行: | ||
− | <div id="examples_center"><!-- 页面标题 --><div class="title-hd">地点检索</div><!-- 标题下子标题及简介,可有多个 --><div class="title-mi">功能场景</div><div class="wrap-mi">支持用户根据关键词查询出行的起终点、兴趣点等,可结合路线规划、导航等功能使用。</div><!-- --></div><div class="demos_wrap"><div class="header"><div class="andiord-header active">Android</div><div class="ios-header">iOS</div></div><div class="andiord-wrap wrap"><div class="wrap-wp"><div class="wrap_left"><div class="left-video"><div class="img-bg-and"></div><div class="phone-android"><div class="video-wrap infor"><div class="video-control"></div><!-- 安卓视频位置 (不写协议)--><pre>//mapopen-website-wiki.bj.bcebos.com/demos/AndroidVideos/ | + | <div id="examples_center"><!-- 页面标题 --><div class="title-hd">地点检索</div><!-- 标题下子标题及简介,可有多个 --><div class="title-mi">功能场景</div><div class="wrap-mi">支持用户根据关键词查询出行的起终点、兴趣点等,可结合路线规划、导航等功能使用。</div><!-- --></div><div class="demos_wrap"><div class="header"><div class="andiord-header active">Android</div><div class="ios-header">iOS</div></div><div class="andiord-wrap wrap"><div class="wrap-wp"><div class="wrap_left"><div class="left-video"><div class="img-bg-and"></div><div class="phone-android"><div class="video-wrap infor"><div class="video-control"></div><!-- 安卓视频位置 (不写协议)--><pre>https://mapopen-website-wiki.bj.bcebos.com/demos/AndroidVideos/didianjiansuo_2.mp4</pre> |
</div><div class="video-icon-and"><div class="play play-and"></div><div class="stop stop-and"></div></div></div><div class="progressWrap-hide-and"></div><div id="videoControls-and"><div id="progressWrap-and"><div id="playProgress-and"></div></div></div></div><div class="left-qrCode"><!-- 安卓二维码位置 --><div class="qrCode-and">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/地点检索@2xanidroid.png</div><div>扫码体验</div></div></div><div class="wrap_right"><div class="wrap_right_nav"><div class="wrap_right_nav_l"><div>使用产品</div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">Android地图SDK|/index.php?title=androidsdk</div><!-- --><div>></div><div class="documentA">POI城市检索|/index.php?title=androidsdk/guide/search/poi</div></div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">Android地图SDK|/index.php?title=androidsdk</div><!-- --><div>></div><div class="documentA">地点输入提示检索|/index.php?title=androidsdk/guide/search/poi</div></div></div><div class="wrap_right_nav_r">下载源码</div><!-- 安卓源码地址 --><div class="github-url-and">//mapopen-website-wiki.bj.bcebos.com/demos/BaiduMapSDKExample.zip</div></div><div class="wrap_table"><div class="table_nav"><div class="left-icon"></div><div>核心接口</div></div><div class="table_wrap"><div class="table_wrap_title"><div>类</div><div>接口</div><div>描述</div></div><!-- 表格接口,可有多个 --><div class="table_wrap_con"><div class="table_wrap_w"><div><div class="table-wrap-className">PoiSearch</div></div><div><div>searchInCity(PoiCitySearchOption option)</div></div><div><div>城市内检索</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiSearch</div></div><div><div>setOnGetPoiSearchResultListener(OnGetPoiSearchResultListener poiResultListener)</div></div><div><div>设置检索结果回调</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>city(String city)</div></div><div><div>设置检索城市</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>keyword(String key)</div></div><div><div>搜索关键字</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>cityLimit(boolean cityLimit)</div></div><div><div>设置区域数据召回限制 为true时,仅召回city对应区域内数据</div></div></div></div></div></div></div></div><div class="pre-nav"><div class="left-icon"></div><div>重点关注</div></div><div class="pre-nav"><div style="margin-left: 10px;">检索完成后需要调用PoiSearch的destroy()方法,否则会有内存泄露。</div></div><div class="pre-nav"><div class="left-icon"></div><div>核心代码</div></div><div class="pre-nav"><div>1.发起检索请求</div></div><div class="pre-wrap"><div class="pre-wrap-nav"><div>JAVA</div></div><!-- 安卓示例代码位置 --><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint prettyprinted pre-and">// 发起请求 | </div><div class="video-icon-and"><div class="play play-and"></div><div class="stop stop-and"></div></div></div><div class="progressWrap-hide-and"></div><div id="videoControls-and"><div id="progressWrap-and"><div id="playProgress-and"></div></div></div></div><div class="left-qrCode"><!-- 安卓二维码位置 --><div class="qrCode-and">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/地点检索@2xanidroid.png</div><div>扫码体验</div></div></div><div class="wrap_right"><div class="wrap_right_nav"><div class="wrap_right_nav_l"><div>使用产品</div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">Android地图SDK|/index.php?title=androidsdk</div><!-- --><div>></div><div class="documentA">POI城市检索|/index.php?title=androidsdk/guide/search/poi</div></div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">Android地图SDK|/index.php?title=androidsdk</div><!-- --><div>></div><div class="documentA">地点输入提示检索|/index.php?title=androidsdk/guide/search/poi</div></div></div><div class="wrap_right_nav_r">下载源码</div><!-- 安卓源码地址 --><div class="github-url-and">//mapopen-website-wiki.bj.bcebos.com/demos/BaiduMapSDKExample.zip</div></div><div class="wrap_table"><div class="table_nav"><div class="left-icon"></div><div>核心接口</div></div><div class="table_wrap"><div class="table_wrap_title"><div>类</div><div>接口</div><div>描述</div></div><!-- 表格接口,可有多个 --><div class="table_wrap_con"><div class="table_wrap_w"><div><div class="table-wrap-className">PoiSearch</div></div><div><div>searchInCity(PoiCitySearchOption option)</div></div><div><div>城市内检索</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiSearch</div></div><div><div>setOnGetPoiSearchResultListener(OnGetPoiSearchResultListener poiResultListener)</div></div><div><div>设置检索结果回调</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>city(String city)</div></div><div><div>设置检索城市</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>keyword(String key)</div></div><div><div>搜索关键字</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>cityLimit(boolean cityLimit)</div></div><div><div>设置区域数据召回限制 为true时,仅召回city对应区域内数据</div></div></div></div></div></div></div></div><div class="pre-nav"><div class="left-icon"></div><div>重点关注</div></div><div class="pre-nav"><div style="margin-left: 10px;">检索完成后需要调用PoiSearch的destroy()方法,否则会有内存泄露。</div></div><div class="pre-nav"><div class="left-icon"></div><div>核心代码</div></div><div class="pre-nav"><div>1.发起检索请求</div></div><div class="pre-wrap"><div class="pre-wrap-nav"><div>JAVA</div></div><!-- 安卓示例代码位置 --><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint prettyprinted pre-and">// 发起请求 | ||
mPoiSearch.searchInCity((new PoiCitySearchOption()) | mPoiSearch.searchInCity((new PoiCitySearchOption()) |
2023年8月16日 (三) 11:46的最后版本
地点检索
功能场景
支持用户根据关键词查询出行的起终点、兴趣点等,可结合路线规划、导航等功能使用。
Android
iOS
https://mapopen-website-wiki.bj.bcebos.com/demos/AndroidVideos/didianjiansuo_2.mp4
1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/地点检索@2xanidroid.png
扫码体验
使用产品
Android地图SDK|/index.php?title=androidsdk
>
POI城市检索|/index.php?title=androidsdk/guide/search/poi
Android地图SDK|/index.php?title=androidsdk
>
地点输入提示检索|/index.php?title=androidsdk/guide/search/poi
下载源码
//mapopen-website-wiki.bj.bcebos.com/demos/BaiduMapSDKExample.zip
核心接口
类
接口
描述
PoiSearch
searchInCity(PoiCitySearchOption option)
城市内检索
PoiSearch
setOnGetPoiSearchResultListener(OnGetPoiSearchResultListener poiResultListener)
设置检索结果回调
PoiCitySearchOption
city(String city)
设置检索城市
PoiCitySearchOption
keyword(String key)
搜索关键字
PoiCitySearchOption
cityLimit(boolean cityLimit)
设置区域数据召回限制 为true时,仅召回city对应区域内数据
重点关注
检索完成后需要调用PoiSearch的destroy()方法,否则会有内存泄露。
核心代码
1.发起检索请求
JAVA
// 发起请求 mPoiSearch.searchInCity((new PoiCitySearchOption()) .city(cityStr) .keyword(keyWordStr) .pageNum(mLoadIndex) // 分页编号 .cityLimit(false) .scope(scope));
复制
深色
复制成功
2.检索结果回调处理
JAVA
@Override public void onGetPoiResult(PoiResult poiResult) { if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { Toast.makeText(PoiCitySearchActivity.this, "未找到结果", Toast.LENGTH_LONG).show(); return; } List<PoiInfo> poiInfos = poiResult.getAllPoi(); if (null == poiInfos) { return; } // 隐藏之前的 hidePoiInfoLayout(); mRecyclerView.setVisibility(View.VISIBLE); if (null == mPoiItemAdaper) { mPoiItemAdaper = new PoiItemAdapter(poiInfos); } else { mPoiItemAdaper.updateData(poiInfos); } }
复制
深色
复制成功