@(笔记)[Google Maps]@案例:https://github.com/lhywell/map/tree/master/example/example19
https://developers.google.com/maps/?hl=zh-cn
所有 Google Maps JavaScript API 应用均需要身份验证,点击获取密钥
Maps JavaScript API 中提供了下列地图类型:
- roadmap:用于显示默认的道路地图视图。这是默认地图类型。
- satellite:用于显示 Google 地球卫星图片
- hybrid:用于同时显示正常视图和卫星视图
- terrain:用于基于地面信息显示物理地图。
可以利用样式化地图自定义 Google 基础地图的呈现方式,从而更改道路、公园和建成区等元素的视觉显示。
可以快速加载到并流畅运行于移动设备
- Directions(路线服务)
- Distance Matrix(距离服务)
- Elevation(海拔服务)
- 地理编码
- Maximum Zoom Imagery(地图缩放服务)
- 街景
-
JavaScript API https://developers.google.com/maps/documentation/javascript/tutorial
-
WEB 服务API https://developers.google.com/places/web-service/?hl=zh-cn
https://developers.google.com/maps/documentation/javascript/examples/map-simple?hl=zh-cn
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 39.915, lng: 116.404 },
zoom: 12
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCJgDmSHRPAE-USCCzW3Lnj5G1Fj2hjeqM&callback=initMap" async defer></script>
</body>
</html>
下一页:Bing