当前位置:网站首页>Baidu map - introductory tutorial
Baidu map - introductory tutorial
2022-06-25 06:37:00 【Nanchen_ forty-two】
Catalog
One 、 Log in to your account and get your secret key
3、 ... and 、 Create a map container
5、 ... and 、 Set map detail style
One 、 Log in to your account and get your secret key
Get the secret key


A new... Will appear after submission AK That is the so-called secret key

At this time, it can be directly used to call
Two 、 Bring in the map
<script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak= Your secret key ">3、 ... and 、 Create a map container
Then create a box
<div id="container"></div>Four 、 Define box size
Set the box size and hide logo And copyright
#container {
margin: 100px auto;
width: 500px;
height: 300px
}
/* Baidu maps copyright */
.BMap_cpyCtrl {
display: none;
}
/* Baidu Maps logo */
.anchorBL {
/* display: none; */
}5、 ... and 、 Set map detail style
<script type="text/javascript">
var map = new BMapGL.Map("container");
// Allow zooming in and out
map.enableScrollWheelZoom(true);
// Create a map instance
var point = new BMapGL.Point(121.467406, 31.411477, 20);
// Create tag location
var marker = new BMapGL.Marker(new BMapGL.Point(121.467406, 31.411477));
// Default magnification
map.centerAndZoom(point, 20);
function addOverlay() {
map.addOverlay(marker); // Add points
}
addOverlay()
var opts = {
width: 200, // Information window width
height: 100, // Information window height
title: " Exclusive zone for children ", // Message window title
message: " This is an apartment "
}
var infoWindow = new BMapGL.InfoWindow(" Address : Shanghai xx District xx road xxxxx", opts); // Create information window object
marker.addEventListener("click", function () {
map.openInfoWindow(infoWindow, point); // Open the message window
});
// Initialize map , Set center point coordinates and map level
var geolocation = new BMapGL.Geolocation();
var geoc = new BMapGL.Geocoder();
console.log(geoc);
</script>The effect is as follows :

If you want to get the coordinate position by yourself, you can use Pick the coordinate system

边栏推荐
- HCIP Day 16
- At the age of 26, I was transferred to software testing with zero foundation. Now I have successfully entered the job with a monthly salary of 12K. However, no one understands my bitterness
- General test point ideas are summarized and shared, which can be directly used in interview and actual software testing
- The five minute demonstration "teaches" actors to speak foreign languages and can seamlessly switch languages. This AI dubbing company has just received a round a financing of 20million US dollars
- Global and China chemical mechanical polishing abrasive materials market demand outlook and investment scale forecast report 2022 Edition
- Exercise: completion
- After five years of software testing in ByteDance, I was dismissed in December to remind my brother of paddling
- Investment opportunities and operational risk assessment report of China's engineering consulting industry during the 14th Five Year Plan period 2022-2028
- Research Report on global and Chinese vaccine market profit forecast and the 14th five year plan development strategy 2022-2028
- How two hosts in different network segments directly connected communicate
猜你喜欢

cos(a-b)=cosa*cosb+sina*sinb的推导过程

Ht8513 single lithium battery power supply with built-in Dynamic Synchronous Boost 5W mono audio power amplifier IC solution
![[kicad image] download and installation](/img/88/cebf8cc55cb8904c91f9096312859a.jpg)
[kicad image] download and installation

Methods for obtaining some information of equipment

Wechat applet authorization login + mobile phone sending verification code +jwt verification interface (laravel8+php)

JSON. toJSONString(object, SerializerFeature.WriteMapNullValue); Second parameter action

Wan Yin revealed that he was rejected by MIT in this way: "the department doesn't like you". He confronted the principal and realized

Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution

CTFSHOW
![[Suanli network] problems and challenges faced by the development of Suanli network](/img/90/1d537de057113e2b4754e76746f256.jpg)
[Suanli network] problems and challenges faced by the development of Suanli network
随机推荐
mysql 表查询json数据
With a younger brother OCR, say no to various types of verification codes!
Microsoft issued a document to celebrate Net 20th anniversary!
Why can't GC () free memory- Why does gc() not free memory?
Viewing Chinese science and technology from the Winter Olympics (V): the Internet of things
[v2.0] automatic update system based on motion step API (support disconnection reconnection and data compensation)
Cs4344/ht5010 stereo d/a digital to analog converter
[short time energy] short time energy of speech signal based on MATLAB [including Matlab source code 1719]
Laravel8+ wechat applet generates QR code
Research Report on global and Chinese vaccine market profit forecast and the 14th five year plan development strategy 2022-2028
Cve-2022-23131 - bypass SAML SSO authentication
Ht7180 3.7V L 12v/2a built in MOS high current boost IC solution
Drosophila played VR and entered nature. It was found that there were attention mechanisms and working memory. The insect brain was no worse than that of mammals
How two hosts in different network segments directly connected communicate
Analysis report on investment and financing status and operation benefits of global and Chinese dental industry (2022 Edition)
After unplugging the network cable, does the original TCP connection still exist?
Methods for obtaining some information of equipment
Exercise: completion
After five years of software testing in ByteDance, I was dismissed in December to remind my brother of paddling
ASP. Net core - encrypted configuration in asp NET Core