Location:

POI Search

Keyword Search

Keyword search is a search that does not set the search method. The sample code is as follows:

            POISearch mPOISearch=new POISearch();
            // Set the request parameters,
            POISearch.Query query=POISearch.Query.newKeywordQuery("The Great Hall of the People", "Beijing", null);
            // Set to return details
            query.setExinfo(2);
            mPOISearch.setQuery(query);
            // search results interface
            mPOISearch.setListener(new POISearch.Listener() {
                @Override
                Public void onSuccess(final POISearchResult result) {
                    //Search succeeded
                }
    
                @Override
                Public void onFail(APIStatus status) {
                    //Search succeeded
                }
            });
            mPOISearch.search();
        

POISearch.Query Description:
1. The instance can only be obtained by the newKeywordQuery(String keyword, String city, SearchArea area) method in POISearch.Query;
2. The parameter keyword is the search keyword, such as “Great Hall of the People”.
3. The parameter city is the city to be searched for, and it can be the city name/adcode such as “Beijing”.
4. area Search area. Round, rectangular, along the road. Normal search is set to null.
5. The setExinfo(int exinfo) method sets the level of detail of the information returned by the POI. The level of detail supported by exinfo and the level of POI information are as follows:

exinfo value Detail level
1 (default)

Return basic information about POI

2

Returns the details of the POI. Partner information can only be obtained when exinfo=2.

3

Returns the details of the POI, but does not return the sub-POI information of the POI.

Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.

Circular Search

Use the set coordinates as a dot to expand the keyword search within the set radius. The sample code is as follows:

                POISearch mPOISearch=new POISearch();
                // Set the request parameters
                POISearch.Query query= POISearch.Query.newKeywordQuery("The Great Hall of the People", "Beijing", new SearchArea.Circular(new GeoPoint(116.39750, 39.90850), 1000));
                // Set to return details
                query.setExinfo(2);
                mPOISearch.setQuery(query);
                // search results interface
                mPOISearch.setListener(new POISearch.Listener() {
                    @Override
                    Public void onSuccess(final POISearchResult result) {
                        //Search succeeded
                    }
        
                    @Override
                    Public void onFail(APIStatus status) {
                        //Search succeeded
                    }
                });
                mPOISearch.search();
            

POISearch.Query Description:
1. The instance can only be obtained by the newKeywordQuery(String keyword, String city, SearchArea area) method in POISearch.Query;
2. The parameter keyword is the keyword for the search, such as “The Great Hall of the People”;
3. The parameter city is the city to be searched, which can be the city name /adcode such as "Beijing";
4. area search area, the circular area parameter setting is explained as follows:
5. new SearchArea.Circular(GeoPoint point, int radius), the parameters are explained as follows:
(1) point: is the Geopoint class, the origin of the circle.
(2) radius: int class, search radius, unit meter.
6. The setExinfo(int exinfo) method sets the level of detail of the information returned by the POI. The level of detail supported by exinfo and the level of POI information are as follows:

exinfo value Detail level
1 (default)

Return basic information about POI

2

Returns the details of the POI. Partner information can only be obtained when exinfo=2.

3

Returns the details of the POI, but does not return the sub-POI information of the POI.

Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.

Rectangle Search

Search by keyword within the upper left and lower right corners of the set, the sample code is as follows:

                    POISearch mPOISearch=new POISearch();
                    // Set the request parameters
                    POISearch.Query query= POISearch.Query.newKeywordQuery("The Great Hall of the People", "Beijing", new SearchArea.Bounds(new GeoRect(116.43423, 39.93766, 116.39750, 39.90850)));
                    // Set to return details
                    query.setExinfo(2);
                    mPOISearch.setQuery(query);
                    // search results interface
                    mPOISearch.setListener(new POISearch.Listener() {
                        @Override
                        Public void onSuccess(final POISearchResult result) {
                            //Search succeeded
                        }
            
                        @Override
                        Public void onFail(APIStatus status) {
                            //Search succeeded
                        }
                    });
                    mPOISearch.search();
                

POISearch.Query Description:
1. The instance can only be obtained by the newKeywordQuery(String keyword, String city, SearchArea area) method in POISearch.Query;
2. Parameter keyword: Search for keywords, such as "Great Hall Hotel";
3. Parameter city: the city to be searched for, can be the city name /adcode such as Beijing;
4. Parameter area: Search area, rectangular area parameter setting new SearchArea.Bounds(GeoRect geoRect)
5. GeoRect class, new SearchArea.Bounds(new GeoRect(left, top, right, bottom), the parameters are explained as follows:
(1) left: the coordinates of the upper left corner;
(2) top: coordinate latitude in the upper left corner;
(3) right: the coordinates of the lower right corner;
(4) bottom: The lower right coordinate latitude.
6. The setExinfo(int exinfo) method sets the level of detail of the information returned by the POI. The level of detail supported by exinfo and the level of POI information are as follows:

exinfo value Detail level
1 (default)

Return basic information about POI

2

Returns the details of the POI. Partner information can only be obtained when exinfo=2.

3

Returns the details of the POI, but does not return the sub-POI information of the POI.

Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.

Search Along the Way

Search the keyword along the route with the set of route coordinates. The sample code is as follows:

                    POISearch mPOISearch=new POISearch();
                    // Set the request parameters
                    GeoPoint[] geoPoints=new GeoPoint[2];
                    geoPoints[0]=new GeoPoint(116.39750, 39.90850);
                    geoPoints[1]= new GeoPoint(116.43423, 39.93766);
                    POISearch.Query query= POISearch.Query.newKeywordQuery("The Great Hall of the People", "Beijing", new SearchArea.Path(geoPoints));
                    // Set to return details
                    query.setExinfo(2);
                    mPOISearch.setQuery(query);
                    // search results interface
                    mPOISearch.setListener(new POISearch.Listener() {
                        @Override
                        Public void onSuccess(final POISearchResult result) {
                            //Search succeeded
                        }
            
                        @Override
                        Public void onFail(APIStatus status) {
                            //Search succeeded
                        }
                    });
                    mPOISearch.search();
                

POISearch.Query Description:
1. The instance can only be obtained by the newKeywordQuery(String keyword, String city, SearchArea area) method in POISearch.Query;
2. Parameter keyword: Search for keywords, such as "Great Hall Hotel";
3. Parameter city: the city to search for, can be the name of the city, such as Beijing;
4. Parameter area: Search area, set the new SearchArea.Path(GeoPoint[] geoPointArray) along the path parameter, and the parameter geoPointArray is the array of coordinate points passed by the route.
5. The setExinfo(int exinfo) method sets the level of detail of the information returned by the POI. The level of detail supported by exinfo and the level of POI information are as follows:

exinfo valueDetail level
1 (default)

Return basic information about POI

2

Returns the details of the POI. Partner information can only be obtained when exinfo=2.

3

returns the details of the POI, but does not return the sub-POI information of the POI.

Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.

Details Query

POI information search obtains POI information based on the IId of the POI. The sample code is as follows:

                //Setting parameters
                POIDetailSearch.POIDetailQuery poiDetailQuery = POIDetailSearch.POIDetailQuery.newQuery (poiId);
                // Set to return details
                poiDetailQuery.setExinfo(2);
                // Set parameters, listen, open search
                POIDetailSearch.searchPoiDetail(poiDetailQuery, new POIDetailSearch.POIDetailListener() {
                    @Override
                    Public void onSuccess(POI result) {
                        // Search succeeds, get POI information
                    }
    
                    @Override
                    Public void onFail(APIStatus status) {
                        //Search failed
                    }
                });
            

POIDetailSearch.POIDetailQuery constructor description:

1. POIDetailSearch.POIDetailQuery.newQuery (String poiId); The constructor parameter poiId is obtained by gettingPid() in the POI after obtaining the POI information.
2. The setExinfo(int exinfo) method sets the level of detail of the information returned by the POI. The level of detail supported by exinfo and the level of POI information are as follows:

exinfo value Detail level
1 (default)

Return basic information about POI

2

Returns the details of the POI. Partner information can only be obtained when exinfo=2.

3

returns the details of the POI, but does not return the sub-POI information of the POI.

Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.

Partner Information Query

Acquire the POI partner information based on the partner id and partner name in the POI information. The sample code is as follows:

                // Setting parameters
                POIDetailSearch.CPInfoQuery cpInfoQuery = POIDetailSearch.CPInfoQuery.newQuery (extend.getCpId(), extend.getCpName());
                // Initiate a request
                POIDetailSearch.searchCPInfo(cpInfoQuery, new POIDetailSearch.CPInfoListener() {
                    @Override
                    Public void onSuccess(final CPInfo result) {
                        // Successfully got the partner information cpinfo
                    }

                    @Override
                    Public void onFail(APIStatus status) {
                        // Failed to get results
                    }
                });
            

POIDetailSearch.CPInfoQuery constructor description:
1. POIDetailSearch.CPInfoQuery.newQuery(String cpId, String cpName): Constructor
2. The parameters cpid and cpName are obtained by setting the return POI details (refer to the setExinfo(int exinfo) method, and when exinfo is 2), the Extend is obtained in the POI, including cpId and cpName. The getExtend() method in the POI class gets the Extend class, the getCpId() method in Extend gets the CpId, and the getCpName() in the Extentd gets the cpName.
Note: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread.

TOP