IOS development based on Baidu map (3) -- address search

Source: Internet
Author: User

Poi search in the previous article can search for poi in a specific range around the specified location. If you want to search for "Beijing" in Shanghai People's Square, poi returns a list of Beijing Roast Duck shops nearby. For this reason, sometimes we need to identify whether the user-entered search content is an address. here we need to use the address search described in this article.

1. Search first

Bmksearch * search = [[bmksearch alloc] init]; // create a search object search. delegate = self; // when the proxy is set to itself, the function [search geocode: "Beijing" withcity: @ ""] in the next step is automatically called back after the search. // search for Beijing // [Search release]; // Note: release is not supported. Otherwise, it cannot be searched. Define search as a member variable.

2. Process search results

- (void)onGetAddrResult:(BMKAddrInfo*)result errorCode:(int)error{    if (error == BMKErrorOk) {        BMKPointAnnotation* item = [[BMKPointAnnotation alloc]init];        item.coordinate = result.strAddr;        item.title = result.geoPt;        [mapView addAnnotation:item];        [item release];    }}

The above callback will automatically display the searched poi on the map through annotation.

IOS development based on Baidu map (1) -- current user location

IOS development based on Baidu map (2) -- getting poi

IOS development based on Baidu map (3) -- address search

IOS development based on Baidu map (4) -- path search

IOS development based on Baidu map (5)-Summary of core issues

IOS development based on Baidu map (6) -- Google coordinates to hundreds of coordinates

IOS development based on Baidu map (7) -- convert Baidu coordinates to Google coordinates

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.