|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <title>MapV 面</title> |
| 6 | + <link rel="stylesheet" href="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.css"> |
| 7 | +</head> |
| 8 | +<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;"> |
| 9 | +<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div> |
| 10 | +<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> |
| 11 | +<script type="text/javascript" src="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.js"></script> |
| 12 | +<script type="text/javascript" src="http://mapv.baidu.com/build/mapv.min.js"></script> |
| 13 | +<script type="text/javascript" src="../../dist/iclient9-leaflet.min.js"></script> |
| 14 | +<script type="text/javascript"> |
| 15 | + |
| 16 | + var map = L.map('map', { |
| 17 | + center: [39.93, 116.402], |
| 18 | + zoom: 12, |
| 19 | + }); |
| 20 | + |
| 21 | + var mbAttr = 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
| 22 | + token = "pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw", |
| 23 | + mbUrl = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=' + token; |
| 24 | + |
| 25 | + L.tileLayer(mbUrl, {id: 'mapbox.light', attribution: mbAttr}).addTo(map); |
| 26 | + loadData(); |
| 27 | + |
| 28 | + //示例数据来源为百度MapV的加偏数据,iClient9未做纠偏处理 |
| 29 | + function loadData() { |
| 30 | + $.get('../data/beijing-village.json', function (geojson) { |
| 31 | + var dataSet = new mapv.DataSet(geojson); |
| 32 | + |
| 33 | + var options = { |
| 34 | + fillStyle: 'rgba(255, 80, 53, 0.8)', |
| 35 | + strokeStyle: 'rgba(250, 255, 53, 0.8)', |
| 36 | + size: 3, |
| 37 | + lineWidth: 1, |
| 38 | + draw: 'simple' |
| 39 | + }; |
| 40 | + |
| 41 | + var dataAttr = "数据来源<a target='_blank' href='http://mapv.baidu.com/examples/beijing-village.html'>MapV</a>"; |
| 42 | + L.supermap.mapVLayer(dataSet, options, {attributionPrefix: dataAttr}).addTo(map); |
| 43 | + |
| 44 | + |
| 45 | + setTimeout(function () { |
| 46 | + map.openPopup("示例数据来源为百度MapV的加偏数据,iClient9未做纠偏处理", map.getCenter()); |
| 47 | + }, 1000) |
| 48 | + }); |
| 49 | + } |
| 50 | + |
| 51 | + |
| 52 | +</script> |
| 53 | + |
| 54 | +</body> |
| 55 | +</html> |
0 commit comments