antv-l7/demos/vectorTilepolygon.html

76 lines
1.8 KiB
HTML
Raw Normal View History

2019-05-28 11:35:31 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="geometry" content="diagram">
<link rel="stylesheet" href="./assets/common.css">
<link rel="stylesheet" href="./assets/info.css">
<title>hexagon demo</title>
<style>
body {margin: 0;}
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id="map"></div>
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
<script src="./assets/color-hash.js"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
2019-07-02 20:27:23 +08:00
window.L7 = L7;
2019-05-28 11:35:31 +08:00
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [116.5909,39.9225 ],
pitch: 0,
hash:true,
2019-06-10 11:54:11 +08:00
zoom: 4,
2019-05-28 11:35:31 +08:00
});
window.scene = scene;
var colorHash = new ColorHash();
2019-06-14 10:08:42 +08:00
2019-06-20 17:54:07 +08:00
2019-05-28 11:35:31 +08:00
scene.on('loaded', () => {
2019-06-26 14:30:29 +08:00
const layer = scene.VectorTileLayer({
zIndex:0,
layerType:'polygon'
2019-06-20 17:54:07 +08:00
})
2019-07-02 20:27:23 +08:00
// http://alipay-rmsdeploy-image.cn-hangzhou.alipay.aliyun-inc.com/thinkgis/tile/county/{z}/{x}/{y}.pbf
.source('http://alipay-rmsdeploy-image.cn-hangzhou.alipay.aliyun-inc.com/thinkgis/tile/county/{z}/{x}/{y}.pbf',{
2019-05-28 11:35:31 +08:00
parser:{
type: 'mvt',
2019-07-02 20:27:23 +08:00
sourceLayer:'county',
2019-07-23 21:43:52 +08:00
idField:'id',
maxZoom: 9
2019-05-28 11:35:31 +08:00
}
2019-07-23 21:43:52 +08:00
})
.scale({
'OBJECTID':{
min:0,
max:3000,
type:'linear'
}
})
2019-07-15 20:45:45 +08:00
.shape('fill')
2019-05-28 11:35:31 +08:00
.size(2)
2019-06-10 11:54:11 +08:00
.active(false)
2019-07-23 21:43:52 +08:00
.color('OBJECTID',['#d53e4f','#f46d43','#fdae61','#fee08b','#ffffbf','#e6f598','#abdda4','#66c2a5','#3288bd'])
2019-05-28 11:35:31 +08:00
.style({
opacity:1.0
})
2019-06-14 10:08:42 +08:00
.render();
2019-05-28 11:35:31 +08:00
});
2019-06-14 10:08:42 +08:00
2019-05-28 11:35:31 +08:00
</script>
</body>
</html>