产品服务
解决方案
文档与支持
定价

文档全面上新

更科技的视觉体验,更高效的页面结构,快前往体验吧!

体验新版
空间搜索
Android
iOS
https://mapopen-website-wiki.cdn.bcebos.com/demos/andDemos/yingyan/空间搜索.mp4
扫码体验
使用产品
下载源码
核心接口
接口
描述
aroundSearchEntity(AroundSearchRequest request, OnEntityListener listener)
鹰眼周边搜索
LBSTraceClient
boundSearchEntity(BoundSearchRequest request, OnEntityListener listener)
鹰眼矩形搜索
districtSearchEntity(DistrictSearchRequest request, OnEntityListener listener)
鹰眼行政区搜索
setServiceId(long serviceId)
设置鹰眼服务ID
setCenter(Latlng latlng)
设置中心点
setCoordTypeOutput(CoordType type)
设置输出坐标类型
setCoordTypeInput(CoordType type)
设置输入坐标类型
setRadius(double radius)
设置半径
AroundSearchRequest
setFilterCondition(FilterCondition filterCondition)
设置过滤条件
setPageIndex(int i)
设置分页索引
setTag(int tag)
设置请求标识
setPageSize(int i)
设置分页大小
setServiceId(long serviceId)
设置鹰眼服务ID
setCoordTypeOutput(CoordType type)
设置输出坐标类型
setCoordTypeInput(CoordType type)
设置输入坐标类型
setPageIndex(int i)
设置分页索引
setPageSize(int i)
设置分页大小
BoundSearchRequest
setFilterCondition(FilterCondition filterCondition)
设置过滤条件
setLowerLeft (Latlng latlng)
设置左下角坐标
setUpperRight (Latlng latlng)
设置右上角坐标
setTag(int tag)
设置请求标识
setServiceId(long serviceId)
设置鹰眼服务ID
setFilterCondition(FilterCondition filterCondition)
设置过滤条件
setCoordTypeOutput(CoordType type)
设置输出坐标类型
setKeyword(String keyword)
设置关键字
DistrictSearchRequest
setReturnType(ReturnType type)
设置返回值内容
setPageIndex(int i)
设置分页索引
setPageSize(int i)
设置分页大小
setTag(int tag)
设置请求标识
核心代码
1.发起检索请求和检索结果处理
JAVA
case R.id.nearby_search_btn:
//根据圆心半径和筛选条件进行搜索
AroundSearchRequest aroundSearchRequest = new AroundSearchRequest(tag,
        trackApp.serviceId, center, radius, coordTypeInput, filterCondition, coordTypeOutput, pageIndex, pageSize);
OnEntityListener onEntityAroundListener = new OnEntityListener() {
    @Override
    public void onAroundSearchCallback(AroundSearchResponse aroundSearchResponse) {
        super.onAroundSearchCallback(aroundSearchResponse);
        // 周边搜索回调接口
        if (aroundSearchResponse == null || aroundSearchResponse.getEntities() == null) {
            return;
        }
        List<com.baidu.mapapi.model.LatLng> aroundLocations = new ArrayList<>();
        List<EntityInfo> entities = aroundSearchResponse.getEntities();
        for (EntityInfo entityInfo: entities) {
            LatLng location = entityInfo.getLatestLocation().getLocation();
            com.baidu.mapapi.model.LatLng latLng = mMapUtil.convertTrace2Map(location);
            aroundLocations.add(latLng);
        }

        showArea(aroundLocations, 0);
        Log.d("SearchActivity", aroundSearchResponse.message + aroundSearchResponse.tag + "收到" + aroundSearchResponse.status + aroundLocations.toString());
    }
};
trackApp.mClient.aroundSearchEntity(aroundSearchRequest, onEntityAroundListener);
break;
case R.id.bound_search_btn:
// 创建矩形检索实例
BoundSearchRequest boundSearchRequest = new BoundSearchRequest(tag, trackApp.serviceId, lowerLeft,
        upperRight, coordTypeInput, filterCondition, coordTypeOutput, pageIndex, pageSize);
OnEntityListener onEntityBoundListener = new OnEntityListener() {
    @Override
    public void onBoundSearchCallback(BoundSearchResponse boundSearchResponse) {
        super.onBoundSearchCallback(boundSearchResponse);
        // 矩形搜索回调接口
        if (boundSearchResponse == null || boundSearchResponse.getEntities() == null) {
            return;
        }
        List<com.baidu.mapapi.model.LatLng> boundLocations = new ArrayList<>();
        List<EntityInfo> entities = boundSearchResponse.getEntities();
        for (EntityInfo entityInfo: entities) {
            LatLng location = entityInfo.getLatestLocation().getLocation();
            com.baidu.mapapi.model.LatLng latLng = mMapUtil.convertTrace2Map(location);
            boundLocations.add(latLng);
        }

        showArea(boundLocations, 1);
        Log.d("SearchActivity", boundSearchResponse.message + boundSearchResponse.tag + "收到" + boundSearchResponse.status + boundLocations.toString());
    }
};
trackApp.mClient.boundSearchEntity(boundSearchRequest, onEntityBoundListener);
break;
case R.id.district_search_btn:
// 创建行政区检索实例
DistrictSearchRequest districtSearchRequest = new DistrictSearchRequest(tag, trackApp.serviceId, filterCondition, coordTypeOutput,
        districtStr, ReturnType.all, pageIndex, pageSize);
OnEntityListener onEntityDistrictListener = new OnEntityListener() {
    @Override
    public void onDistrictSearchCallback(DistrictSearchResponse districtSearchResponse) {
        super.onDistrictSearchCallback(districtSearchResponse);
        // 行政区搜索回调接口
        if (districtSearchResponse == null || districtSearchResponse.getEntities() == null) {
            return;
        }
        districtLocations = new ArrayList<>();
        List<EntityInfo> entities = districtSearchResponse.getEntities();
        for (EntityInfo entityInfo: entities) {
            LatLng location = entityInfo.getLatestLocation().getLocation();
            com.baidu.mapapi.model.LatLng latLng = mMapUtil.convertTrace2Map(location);
            districtLocations.add(latLng);
        }
        mDistrictSearch.searchDistrict(new DistrictSearchOption().cityName("北京市").districtName("海淀区"));
        Log.d("SearchActivity", districtSearchResponse.message + districtSearchResponse.tag + "收到" + districtSearchResponse.status + districtLocations.toString());
    }
};
trackApp.mClient.districtSearchEntity(districtSearchRequest, onEntityDistrictListener);

break;

                
复制
深色
复制成功
  • 文档根本没法用

  • 文档水平很差

  • 文档水平一般

  • 文档不错

  • 文档写的很好

如发现文档错误,或对此文档有更好的建议,请在下方反馈。问题咨询请前往反馈平台提交工单咨询。

提交反馈

拖动标注工具

添加矩形标注

添加箭头标注

完成

取消