antv-l7/demos/07_city.html

88 lines
2.2 KiB
HTML
Raw Normal View History

2018-10-31 11:29:54 +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">
2018-11-20 15:04:21 +08:00
<link rel="stylesheet" href="./assets/info.css">
2018-10-31 11:29:54 +08:00
<title>city</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
2018-11-20 15:04:21 +08:00
<div id="map">
<div id ="info" class ="tooltip" style="display:none">
</div>
2018-10-31 11:29:54 +08:00
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
2018-11-16 16:52:25 +08:00
mapStyle: 'light', // 样式URL
center: [120.173104, 30.244072],
pitch: 66.50572,
zoom: 15.79,
2018-11-08 20:56:17 +08:00
minZoom:10
2018-10-31 11:29:54 +08:00
});
window.scene = scene;
scene.on('loaded', () => {
2018-11-20 20:07:22 +08:00
$.get('https://gw.alipayobjects.com/os/rmsportal/XHMbjQwrSrajvLLvMPbK.json', data => {
2018-10-31 11:29:54 +08:00
scene.PolygonLayer({
zIndex: 0
})
.source(data)
.shape('fill')
.active({fill:'blue'})
2018-11-16 16:52:25 +08:00
.color('rgb(79,174,234)')
2018-10-31 11:29:54 +08:00
.render();
});
2018-11-20 20:07:22 +08:00
$.get('https://gw.alipayobjects.com/os/rmsportal/VifgwJEyBIXnDrjCwWdK.json', data => {
2018-10-31 11:29:54 +08:00
scene.PolygonLayer({
zIndex: 0
})
.source(data)
.shape('fill')
2018-11-16 16:52:25 +08:00
.color('rgb(156,194,116)')
2018-10-31 11:29:54 +08:00
.render();
});
2018-11-20 20:07:22 +08:00
$.get('https://gw.alipayobjects.com/os/rmsportal/ZseLNWMOPGrgqQYfvtli.json', data => {
2018-10-31 11:29:54 +08:00
scene.LineLayer({
zIndex: 2
})
.source(data)
2018-11-20 15:04:21 +08:00
.shape('line')
2018-11-16 16:52:25 +08:00
.size([3,0])
.color('rgb(79,174,234)')
2018-10-31 11:29:54 +08:00
.render();
});
2018-11-20 20:07:22 +08:00
$.get('https://gw.alipayobjects.com/os/rmsportal/ggFwDClGjjvpSMBIrcEx.json', data => {
2018-11-20 15:04:21 +08:00
citylayer = scene.PolygonLayer({
2018-10-31 11:29:54 +08:00
zIndex: 2
})
.source(data)
.shape('extrude')
2018-11-20 15:04:21 +08:00
.active({fill:'red'})
2018-11-16 16:52:25 +08:00
.size('floor',[10,2000])
.color('rgba(242,246,250,0.96)')
2018-10-31 11:29:54 +08:00
.render();
/**
2018-11-20 15:04:21 +08:00
citylayer.on('click',(e)=>{
$("#info").css({'left': e.pixel.x,'top':e.pixel.y, display:'block'});
$("#info").html(`<p>楼高<span">${e.feature.properties.floor || 0}</span></p>`);
})
**/
2018-10-31 11:29:54 +08:00
});
});
</script>
</body>
</html>