OpenLayersSample

by LandsD Map API

HTML

<script src="https://openlayers.org/en/v3.20.1/build/ol.js"></script>
<link rel="stylesheet" href="https://openlayers.org/en/v3.20.1/css/ol.css">
<div id="map" class="map" height="250px"></div>

JavaScript

var map = new ol.Map({
       target: 'map',
       layers: [
         new ol.layer.Tile({
           source: new ol.source.XYZ({
             //attributions: [attribution],
             url: 'https://mapapi.blob.core.windows.net/tilecaches/HKMapServiceBase' +
               '/{z}/{y}/{x}.png?Key=e68810d810e144358961d2295b515f60'
           })
         }),
       ],
       view: new ol.View({
         center: ol.proj.fromLonLat([114.20847, 22.29227]),
         zoom: 17,
         minZoom: 10,
         maxZoom: 20
       })
     });