ol.Map 是openlayers核心的部分
此处引用openlayers官网上quirk start 源码
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://openlayers.org/en/v4.2.0/css/ol.css" type="text/css">
<style>
.map { //设置放置map的div的大小
height: 400px;
width: 100%;
}
</style>
<script src="https://openlayers.org/en/v4.2.0/build/ol.js" type="text/javascript"></script>
<title>OpenLayers example</title>
</head>
<body>
<h2>My Map</h2>
<div id="map" class="map"></div>
<script type="text/javascript">