第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/地点检索@android.mp4</pre> | <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/地点检索@android.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><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()) | ||
.city(cityStr) | .city(cityStr) | ||
第33行: | 第33行: | ||
</pre> | </pre> | ||
<div class="pre-btn"><div class="pre-btn-copy-and">复制</div><div class="pre-btn-cb-and">深色</div></div><div class="success">复制成功</div></div></div></div><div class="ios-wrap wrap" style="display: none;"><div class="wrap-wp"><div class="wrap_left"><div class="left-video"><div class="img-bg-ios-sh"></div><div class="phone-ios"><div class="video-wrap infor"><div class="video-control"></div><!-- ios视频位置 --><pre>https://mapopen-website-wiki.bj.bcebos.com/demos/iosVideos/地点检索@3xios.mp4</pre> | <div class="pre-btn"><div class="pre-btn-copy-and">复制</div><div class="pre-btn-cb-and">深色</div></div><div class="success">复制成功</div></div></div></div><div class="ios-wrap wrap" style="display: none;"><div class="wrap-wp"><div class="wrap_left"><div class="left-video"><div class="img-bg-ios-sh"></div><div class="phone-ios"><div class="video-wrap infor"><div class="video-control"></div><!-- ios视频位置 --><pre>https://mapopen-website-wiki.bj.bcebos.com/demos/iosVideos/地点检索@3xios.mp4</pre> | ||
− | </div><div class="video-icon-ios"><div class="play play-ios"></div><div class="stop stop-ios"></div></div></div><div class="progressWrap-hide-ios"></div><div id="videoControls-ios"><div id="progressWrap-ios"><div id="playProgress-ios"></div></div></div></div><div class="left-qrCode iosqrCode"><!-- ios二维码位置 --><div class="qrCode-ios">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/ioscodes/地点检索@1xios.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><div class="video-icon-ios"><div class="play play-ios"></div><div class="stop stop-ios"></div></div></div><div class="progressWrap-hide-ios"></div><div id="videoControls-ios"><div id="progressWrap-ios"><div id="playProgress-ios"></div></div></div></div><div class="left-qrCode iosqrCode"><!-- ios二维码位置 --><div class="qrCode-ios">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/ioscodes/地点检索@1xios.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">iOS地图SDK|/index.php?title=iossdk</div><!-- --><div>></div><div class="documentA">POI城市检索|/index.php?title=iossdk/guide/search/poi</div></div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">iOS地图SDK|/index.php?title=iossdk</div><!-- --><div>></div><div class="documentA">地点输入提示检索|/index.php?title=iossdk/guide/search/suggestion</div></div></div><div class="wrap_right_nav_r">下载源码</div><!-- IOS源码地址 --><div class="github-url-ios">//mapopen-website-wiki.bj.bcebos.com/BaiduMapSDKDemo.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><!-- ios表格接口内容,可有多个 --><!-- 表格接口,可有多个 --><div class="table_wrap_con"><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPOICitySearchOption</div></div><div><div>NSString *keyword</div></div><div><div>检索关键字(必选)</div></div></div><!-- --><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPOICitySearchOption</div></div><div><div>NSString *city</div></div><div><div>区域名称(必选)</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPOICitySearchOption</div></div><div><div>Bool isCityLimit</div></div><div><div>区域数据返回限制(可选)</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPoiSearch</div></div><div><div>- (BOOL)poiSearchInCity:(BMKPOICitySearchOption*)option;</div></div><div><div>发起城市POI检索</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPoiSearch</div></div><div><div>- (void)onGetPoiResult:(BMKPoiSearch*)searcher result:(BMKPOISearchResult*)poiResult errorCode:(BMKSearchErrorCode)errorCode;</div></div><div><div>返回POI搜索结果</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearchOption</div></div><div><div>NSString *keyword</div></div><div><div>搜索关键字,必选</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearchOption</div></div><div><div>NSString *cityname</div></div><div><div>城市名,参数也可以传入citycode,必选</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearchOption</div></div><div><div>BOOL cityLimit</div></div><div><div>是否只返回指定城市检索结果(默认:NO)(提示:海外区域暂不支持设置cityLimit)</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearch</div></div><div><div>- (BOOL)suggestionSearch:(BMKSuggestionSearchOption *)suggestionSearchOption;</div></div><div><div>发起Sug检索服务</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearch</div></div><div><div>- (void)onGetSuggestionResult:(BMKSuggestionSearch *)searcher result:(BMKSuggestionSearchResult *)result errorCode:(BMKSearchErrorCode)error;</div></div><div><div>返回Sug检索结果</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>1.发起Sug检索与POI检索</div></div><div class="pre-wrap"><div class="pre-wrap-nav"><div>Objective-C</div></div><div class="pre-wrap-w pre-wrap-w-ios code_container"><!-- ios示例代码位置 --><pre class="prettyprint prettyprinted pre-ios">// 根据输入发送sug检索 |
- (void)searchSugInfoWithKey:(NSString *)key { | - (void)searchSugInfoWithKey:(NSString *)key { | ||
if (key.length == 0) { | if (key.length == 0) { | ||
第136行: | 第136行: | ||
</pre> | </pre> | ||
− | <div class="pre-btn"><div class="pre-btn-copy-ios">复制</div><div class="pre-btn-cb-ios">深色</div></div><div class="success">复制成功</div></div></div> | + | <div class="pre-btn"><div class="pre-btn-copy-ios">复制</div><div class="pre-btn-cb-ios">深色</div></div><div class="success">复制成功</div></div></div></div></div> |
− | + | ||
− | </div></div> | + |
2022年2月25日 (五) 17:27的版本
地点检索
功能场景
支持用户根据关键词查询出行的起终点、兴趣点等,可结合路线规划、导航等功能使用。
Android
iOS
//mapopen-website-wiki.bj.bcebos.com/demos/AndroidVideos/地点检索@android.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); } }
复制
深色
复制成功