Baidu map development, marking can only be displayed on Beijing Map t_t

Source: Internet
Author: User

=============== Problem description ====================


Public class mainactivity extends activity {mapview mmapview = NULL; baidumap mbaidumap; // UI-related button resetbtn; button clearbtn; @ override protected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); // initialize the context information before using the SDK components, and pass in the applicationcontext // note that this method must be implemented before the setcontentview method. initialize (getapplicationcontext (); setcontentview (R. layout. activity_main); // get Map Control Reference mmapview = (mapview) findviewbyid (R. id. bmapview); mbaidumap = mmapview. getmap (); // The UI initializes clearbtn = (button) findviewbyid (R. id. btnstart); resetbtn = (button) findviewbyid (R. id. btnstart2); onclicklistener clearlistener = new onclicklistener () {public void onclick (view v) {// clearclick () ;}}; onclicklistener restlistener = new onclicklistener () {public void onclick (view v) {// resetclick () ;}}; clear BTN. setonclicklistener (clearlistener); resetbtn. setonclicklistener (restlistener); // Add the draw layer addcustomelementsdemo () when loading the interface;}/*** Add a vertex, line, polygon, circle, text */Public void addcustomelementsdemo () {// Add text latlng lltext = new latlng (39.86923, 116.397428); // latlng lltext = new latlng (108.7622674067471, 34.0358298501404 ); // my local GPS coordinates overlayoptions ootext = new textoptions (). bgcolor (0xaaffff00 ). fontsize (24 ). fontcolo R (0xffff00ff ). text ("Baidu map SDK "). rotate (-30 ). position (lltext); mbaidumap. addoverlay (ootext) ;}@ override protected void ondestroy () {super. ondestroy (); // execute mmapview when ondestroy is executed in activity. ondestroy () to implement mmapview for map lifecycle management. ondestroy () ;}@ override protected void onresume () {super. onresume (); // execute mmapview when onresume is executed in the activity. onresume () to implement mmapview for map lifecycle management. onresume () ;}@ override protected void onpause () {Super. onpause (); // execute mmapview when onpause is executed in activity. onpause () enables mmapview for map lifecycle management. onpause () ;}} by default, the program is opened on the map of Beijing. I replaced the given GPS coordinates with the local coordinates I collected but cannot locate the local map (Shaanxi ), if the value is displayed on the Beijing map, the added text cannot be displayed ~ Thank you!

============= Solution 1 ======================


Never used Baidu map.

============= Solution 2 ======================


Let's change the longitude and latitude coordinates of 116 and 39. Didn't you find that the order of the following coordinates is different from yours?

Baidu map development, marking can only be displayed on Beijing Map t_t

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.