This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16126|Reply: 3

[Other] Baidu Maps quickly moves to polygon and circle tutorials

[Copy link]
Posted on 11/28/2017 2:48:07 PM | | | |
The project requirements, click on a saved polygon or circular area, you can quickly locate the area, display it on the map, don't talk nonsense, let's look at the renderings first!



As shown in the picture above, we click on the tab on the right to quickly locate the area where the tab is saved

At first, I thought Baidu had a ready-made interface to provide us with calls, but the result was not, and then, from the Internet search, I didn't find any relevant information, so I can only rely on myself, we use the class reference provided by Baidu to achieve the above effect.

getViewport to get the best view of the map based on the geographic area or coordinates provided, returning objects with center and zoom attributes that represent the center point and level of the map, respectively. This method only returns field of view information and does not apply new center points and levels to the current map



This is how we can get the best center point and the best scale for the area

(Circle, in fact, you can get the center point, but you can't get the best scale)

The code is as follows:

Circular area code
Tourists, if you want to see the hidden content of this post, pleaseReply


Polygon, Rectangle Code:
Tourists, if you want to see the hidden content of this post, pleaseReply

Note: You must set the zoom level before moving the center point!!!!




Previous:Utilize Jurassic to execute js functions under .net
Next:css+juqery changes the background color of table rows and columns
Posted on 11/28/2017 3:25:44 PM |
Amazing
Posted on 3/20/2019 3:23:42 PM |
How to write a circle on the sky map and move with the map?
Posted on 2/24/2023 1:07:59 PM |
Look at the situation before talking
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com