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', () => {
|
|
|
|
$.get('./data/water.geojson', data => {
|
|
|
|
scene.PolygonLayer({
|
|
|
|
zIndex: 0
|
|
|
|
})
|
|
|
|
.source(data)
|
|
|
|
.shape('fill')
|
2018-11-16 16:52:25 +08:00
|
|
|
.color('rgb(79,174,234)')
|
2018-10-31 11:29:54 +08:00
|
|
|
.render();
|
|
|
|
});
|
|
|
|
$.get('./data/land.geojson', data => {
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
$.get('./data/river.geojson', data => {
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
|
|
|
$.get('./data/build.geojson', 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>
|
|
|
|
|