Coordinate Conversion between Baidu navigation SDK and iOS navigation sdk

Source: Internet
Author: User

Coordinate Conversion between Baidu navigation SDK and iOS navigation sdk

Examples of code for converting coordinates of Baidu navigation iOS SDK. For more information, see.

 

// Navigation coordinate --------------> map coordinate


// Assume that the coordinate obtained from the navigation sdk is (116.304847, 40.025281)

// (1) construct the input parameter BNPosition required by the Conversion Function

BNPosition * naviPos = [[BNPosition alloc] init];

NaviPos. x = 116.304847;

NaviPos. y = 40.025281;


// Define output parameters

BMapPoint mapPoint = {0, 0 };


// Call the Conversion Function

BOOL ret = [BNTools ConvertBaiduNaviPoint: naviPos ToBaiduMapPoint: & mapPoint];


// Use the converted map coordinates

If (ret)

{

NSLog (@ "the navigation coordinates are converted into map coordinates. After the conversion, MapPoint = (% f, % f)", mapPoint. x, mapPoint. y );

}

Else

{

NSLog (@ "Conversion failed ");

}



// Navigation coordinate --------------> map coordinate

// Assume that the coordinate obtained from the navigation sdk is (116.304847, 40.025281)


// (1) construct the input parameter BNPosition required by the Conversion Function

BNPosition * naviPos = [[BNPosition alloc] init];

NaviPos. x = 116.304847;

NaviPos. y = 40.025281;


// Define output parameters

BMapPoint mapPoint = {0, 0 };


// Call the Conversion Function

BOOL ret = [BNTools ConvertBaiduNaviPoint: naviPos ToBaiduMapPoint: & mapPoint];


// Use the converted map coordinates

If (ret)

{

NSLog (@ "the navigation coordinates are converted into map coordinates. After the conversion, MapPoint = (% f, % f)", mapPoint. x, mapPoint. y );

}

Else

{

NSLog (@ "Conversion failed ");

}


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.