openlayers学习笔记

三章-17-导览控件

2020-04-20  本文已影响0人  彩云飘过

本文基于腾讯课堂老胡的课《跟我学Openlayers--基础实例详解》做的学习笔记,使用的openlayers 5.3.x api。

源码 见 1017.html ,对应的 官网示例 https://openlayers.org/en/latest/examples/scaleline-indiana-east.html?q=rotation

image.png
<!DOCTYPE html>
<html>

<head>
  <title>导览控件的使用
  </title>
  <link rel="stylesheet" href="../include/ol.css" type="text/css">
  <script src="../include/ol.js"></script>

</head>
<style>

</style>

<body>

  <div id="map" class="map"></div>

  <script>
  
  var map = new ol.Map({
        controls: ol.control.defaults().extend([
          new ol.control.ZoomToExtent({
            extent: [
              813079.7791264898, 5929220.284081122,
              848966.9639063801, 5936863.986909639
            ]
          })
        ]),
        layers: [
          new ol.layer.Tile({
            source: new ol.source.OSM()
          })
        ],
        target: 'map',
        view: new ol.View({
          center: [0, 0],
          zoom: 2
        })
        });
  </script>
</body>

</html>
上一篇 下一篇

猜你喜欢

热点阅读