Talking about Baidu Map API Call (Part 1)

             I just read the documentation of Baidu Maps, so I sorted it out a little to help my partners not need to go to Baidu to read the documentation and read the fragmented code snippets.

            Baidu Maps supports calls from PC, mobile, and mobile WeChat. First, let's start with a call example:

            First, you need to register with a Baidu account, and then apply to become a developer, because calling Baidu's API requires an AK key. As for using the API, you need to add a domain name

Whitelist, no domain name you can use the intranet penetration tool to achieve. Above:

           

         After logging in to Baidu Maps to become a developer, you can enter this interface, and then:

         

          We are calling on the client side, so choose the browser side;

         

           This white name is to have your own server, and you can also use the intranet to penetrate;

           Then enter the application name and your AK will be generated:

          

          Next, enter the demo instance;

          Add this code between your html headers:

          

          Successfully introduced JS API;

         Start generating Baidu map: , Note: The ID of this DIV is to correspond to the initialized MAP class, all classes of Baidu map are under the namespace BMap;

          In Baidu DEMO, the example takes Beijing Tiananmen as an example; ; The construction parameter of the Point class is the vicinity of Tiananmen, which is a coordinate value. The point variable points to the center of the map, no matter how you change the coordinates.

            Baidu Map needs to set the scroll wheel to zoom in and out, the default is not this function;

            Baidu map can add controls by itself, or customize controls. This can only refer to the official API class library; there are detailed demos and instructions.

            http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html;

           Add control writing:

           ;ScaleControl() is an officially defined class, all control classes inherit the base class Control;

           For the appearance of the map and the map style; please refer to the official documentation for details, only the basic usage is here;

          

          


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325651028&siteId=291194637