antv-l7/demos/index.html

1906 lines
60 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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">
<link rel="stylesheet" href="./assets/codemirror-5.29.0/codemirror-merged.min.css">
<link rel="stylesheet" href="./assets/bootstrap-4.1.0/bootstrap.min.css">
<link rel="stylesheet" href="./assets/bootstrap-4.1.0/bootstrap-grid.min.css">
<link rel="stylesheet" href="./assets/index.css">
<title>Demos</title>
</head>
<body>
<div id="code-list" style="display: none">
<textarea id="code-01_point_circle"><!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>point_circle</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
.amap-maps {
cursor: auto !important
}
</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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const colorObj ={
blue: ["#E8FCFF", "#CFF6FF", "#A1E9ff", "#65CEF7", "#3CB1F0", "#2894E0", "#1772c2", "#105CB3", "#0D408C", "#002466"].reverse(),
red: ["#FFF4F2", "#FFDFDB", "#FAADAA", "#F77472", "#F04850", "#D63147", "#BD223E", "#A81642", "#820C37", "#5C0023"].reverse(),
orange:["#FFF7EB", "#FFECD4", "#FAD09D", "#F7B16A", "#F08D41", "#DB6C2C", "#C2491D", "#AD2B11", "#871D0C", "#610800"].reverse(),
green:["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"].reverse(),
yellow:["#FFFFE8", "#FFFECC", "#FAF896", "#F7E463", "#F0CE3A", "#DBB125", "#C29117", "#AD7410", "#87500C", "#613000"].reverse(),
purple:["#FCF2FF", "#F5DEFF", "#DDB3F2", "#BE7BE3", "#9B4ECF", "#7737B3", "#5B2899", "#411C85", "#270F5E", "#100338"].reverse()
}
const scene = new L7.Scene({
id: 'map',
mapStyle: 'light', // 样式URL
center: [ 120.19382669582967, 30.258134 ],
pitch: 0,
zoom: 12,
maxZoom:14,
minZoom:11,
});
window.scene = scene;
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/rmsportal/epnZEheZeDgsiSjSPcCv.json', data => {
const circleLayer = scene.PointLayer({
zIndex: 2
})
.source(data,{
scale:{
min:0,
max:1000,
type:'linear'
}
})
.shape('2d:circle')
.size('value', [ 2, 80]) // default 1
//.size('value', [ 10, 300]) // default 1
.active(true)
.filter('value', field_8 => {
return field_8 * 1 > 500;
})
.color('type', colorObj.blue)
.style({
stroke: 'rgb(255,255,255)',
strokeWidth: 1,
opacity: 1.
})
.render();
circleLayer.on('click',(e)=>{
console.log(e);
})
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-01_point_column"><!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">
<title>point_circle</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [104.838088,34.075889 ],
pitch: 35,
zoom: 4.88,
rotation:4.183582
});
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json', data => {
window.layer = scene.PointLayer({
zIndex: 2
})
.source(data.list, {
parser:{
type: 'json',
x: 'j',
y: 'w',
}
})
.shape('cylinder')
.size('t',(level)=> {
return [2,2,(level*3+20)];
})
.active(true)
.color('t', ["#002466","#105CB3","#2894E0","#CFF6FF","#FFF5B8","#FFAB5C","#F27049","#730D1C"])
.render();
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-01_point_distribute"><!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">
<title>point_distribute</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 121.51222019389274, 31.23572578718841 ],
pitch: 0,
zoom: 11
});
window.scene = scene;
scene.on('loaded', () => {
// ./data/mUQPWCYaxOfiSznuANvG.txt
$.get('./data/00.csv', data => {
scene.PointLayer({
zIndex: 2
})
.source(data, {
parser:{
type: 'csv',
y: 'lat',
x: 'lng'
}
})
.size(1.0)
.color('#0D408C')
.style({
stroke: 'rgb(255,255,255)',
strokeWidth: 0,
opacity: 1.0
})
.render();
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-01_point_image"><!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>point_distribute</title>
<style>
body {
margin:0px;
}
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id="map"></div>
<div class ='info'>
<div class="input-card" style='width: 12rem;'>
<div class="input-item">
<input type="radio" name='func' checked=true value=0><span class="input-text">全部</span>
<input type="radio" name='func' value=0><span class="input-text">可用车</span>
<input type="radio" name='func' value=1><span class="input-text">不可用</span>
</div>
</div>
</div>
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
<script src="https://unpkg.com/supercluster@4.1.1/dist/supercluster.min.js"></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',
mapStyle: 'light', // 样式URL
center: [ 120.1243238, 30.27331571 ],
pitch: 0,
zoom: 14,
minZoom: 9
});
window.scene = scene;
scene.on('loaded', () => {
$.get('./data/pointbike.json', data => {
var extent = [ 110,29.2378,122.189,33.3173]
var dataindex = supercluster({radius:80});
dataindex.load(data.features);
var clusterData = dataindex.getClusters(extent,13);
scene.PointLayer({
zIndex: 4,
maxZoom:15.5
})
.source({
"type": "FeatureCollection",
"features":clusterData
})
.color('#6492E9')
.size('point_count',[1,30])
.shape('2d:circle')
.style({
opacity:0.8
})
.render();
// 自行车数据
scene.PointLayer({
zIndex: 4,
minZoom:15.5,
})
.source(data)
.color('power',(v)=>{
return v > 5 ? '#4F93EA' :'#F5684A'
})
.active({fill:'#91C25B'})
.size(8)
.shape('2d:circle')
.style({
opacity:0.7
})
.render();
});
$.get('./data/fence.json', data => {
scene.LineLayer({
zIndex: 5
})
.source(data)
.shape('line')
.size([2,0])
.color('#2F54EB')
.style({
opacity:1.0,
})
.render();
scene.PolygonLayer({
zIndex: 0
})
.source(data)
.shape('fill')
.size([2,0])
.color('#2F54EB')
.style({
opacity:0.05,
})
.render();
});
$.getJSON('./data/pointZone.json', data => {
const fenceLayer = scene.LineLayer({
zIndex: 1,
minZoom:16,
})
.source(data)
.size([1.5,0])
.shape('line')
.color("#2F54EB")
.style({
opacity:1.0,
})
.render();
});
scene.on('zoomchange',(e)=>{
console.log(e);
})
});
</script>
</body>
</html>
</textarea>
<textarea id="code-02_contour"><!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">
<title>hexagon demo</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="./assets/geotiff.browserify.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const color1 = [ 'rgba(37, 140, 249, 0.8)', 'rgba(14, 241, 242, 0.8)', 'rgba(255, 255, 255, 0.8)' ];
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 102.602992, 23.107329],
pitch: 15,
zoom: 14.82,
});
scene.on('loaded', () => {
$.get('./data/contour.geojson', data => {
// data.features = data.features.slice(0,1);
scene.LineLayer({
zIndex: 2
})
.source(data)
.size('ELEV',(value)=>{
return [1,(value-1000)*7];
})
.active(true)
.shape('line')
.color('ELEV',["#E8FCFF", "#CFF6FF", "#A1E9ff", "#65CEF7", "#3CB1F0", "#2894E0", "#1772c2", "#105CB3", "#0D408C", "#002466"].reverse())
.render();
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-02_oneBletoneRoad"><!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">
<title>one belt one road </title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'light', // 样式URL
center: [ 120.3672, 36.0968 ],
pitch: 0,
zoom: 3
});
scene.on('loaded', () => {
scene.image.addImage('local', 'https://gw.alipayobjects.com/zos/rmsportal/xZXhTxbglnuTmZEwqQrE.png');
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/UpapMomPYUeiBjbHNAma.json', region => {
const color = [ 'rgb(22,32,101)', 'rgb(28,43,127)', 'rgb(36,68,142)', 'rgb(45,94,158)', 'rgb(53,119,174)', 'rgb(61,145,190)', 'rgb(70,170,206)', 'rgb(98,190,210)', 'rgb(138,205,206)', 'rgb(179,221,204)', 'rgb(220,236,201)' ];
var points = region.features.map((feature)=>{
return feature.properties;
})
const layer = scene.PolygonLayer({
zIndex:1,
})
.source(region)
.color('cname',(value)=>{
return (value =='中国' ? 'rgba(46,149,169,0.45)': 'rgba(227,244,244,0.1)');
})
.shape('fill')
.render();
});
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/kwUdcXnxQtexeGRvTGtA.json', contourData => {
const layer = scene.LineLayer({
zIndex:2}
)
.source(contourData)
.color('rgb(79,147,234)')
.size([ 1.5, 0 ])
.shape('line')
.style({
'lineType':'solid'
})
.render();
});
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/dzpMOiLYBKxpdmsgBLoE.json', contourData => {
const landlayer = scene.LineLayer(
{zIndex:2}
)
.source(contourData)
.color('rgb(11,94,69)')
.size([ 1.5, 0 ])
.shape('line')
.style({
'lineType':'dash'
})
.render();
});
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/opYqFyDGyGUAUXkLUhBV.json', city => {
var makerLayer = scene.PointLayer({
zIndex: 4
})
.source(city)
.size(20.0)
.shape('image:local')
.color('#0D408C')
.render();
var makerText = scene.PointLayer({
zIndex: 8,
minZoom:5,
})
.source(city)
.size(14.0)
.shape('name', 'text')
.color('rgba(0,0,0,0.85)')
.style({
textOffset:[-20,22],
stroke: '#fff',
strokeWidth: 4,
})
.render();
return
})
})
</script>
</body>
</html>
</textarea>
<textarea id="code-03_1_extrude_polygon"><!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">
<title>extrude Polygon</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id = 'gui' style="position:absolute;top:0px;right:0px;z-index:2;"></div>
<div id="map"></div>
<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="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [104.838088,34.075889 ],
pitch: 27,
zoom: 4.5,
rotation:4.183582
});
window.scene = scene;
scene.on('loaded', () => {
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/xxvoBnsYNEPiAXGRmlPD.json', city => {
citylayer = scene.PolygonLayer()
.source(city)
.color('sum', ["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"])
.shape('extrude')
.size('max',(value)=>{
if(value<0)value =0;
return value * 1000;
})
.active(true)
.style({
opacity: 1.0
})
.render();
const citylayer2 = scene.PolygonLayer()
.source(city)
.shape('line')
.color('#fff')
.style({
opacity: 1
})
.render();
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-03_choropleths_polygon"><!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>
<div id ="info" class ="tooltip" style="display:none"></div>
<div class='info-panel top-right'>
<p>
<label>min</label><input name="minaqi" type="range" step="1" min="0" max="200" value=0> <label>0</label>
</p>
<p>
<label>max</label><input name="maxaqi" type="range" step="1" min="0" max="300" value=300><label>300</label>
</p>
<p><label>color</label><select>
<option value ="default">default</option>
<option value ="blue">blue</option>
<option value ="red">red</option>
<option value="orange">orange</option>
<option value="green">green</option>
<option value="yellow">yellow</option>
<option value="purple">purple</option>
</select> </p>
<div>
<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="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const colorObj ={
blue: ["#E8FCFF", "#CFF6FF", "#98E3FA", "#65CEF7", "#3CB4F0", "#2894E0", "#1A76C7", "#105CB3", "#0D408C", "#002466"],
red: ["#FFF4F2", "#FFDFDB", "#FAADAA", "#F77472", "#F04850", "#D63147", "#BD223E", "#A81642", "#820C37", "#5C0023"],
orange:["#FFF7EB", "#FFECD4", "#FAD09D", "#F7B16A", "#F08D41", "#DB6C2C", "#C2491D", "#AD2B11", "#871D0C", "#610800"],
green:["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"],
yellow:["#FFFFE8", "#FFFECC", "#FAF896", "#F7E463", "#F0CE3A", "#DBB125", "#C29117", "#AD7410", "#87500C", "#613000"],
purple:["#FCF2FF", "#F5DEFF", "#DDB3F2", "#BE7BE3", "#9B4ECF", "#7737B3", "#5B2899", "#411C85", "#270F5E", "#100338"],
}
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [104.838088,34.075889 ],
pitch: 0,
zoom: 4.5,
});
window.scene = scene;
scene.on('loaded', () => {
var colors = ["#FFF5B8","#FFDC7D","#FFAB5C","#F27049","#D42F31","#730D1C"];
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/JToMOWvicvJOISZFCkEI.json', city => {
const citylayer = scene.PolygonLayer()
.source(city)
//.color('pm2_5_24h',["#FFF5B8","#FFDC7D","#FFAB5C","#F27049","#D42F31","#730D1C"])
.color('pm2_5_24h',(p)=>{
if(p>120){
return colors[5];
} else if(p>65){
return colors[4];
} else if(p>30) {
return colors[3];
} else if(p>15){
return colors[2];
} else if(p>8){
return colors[1];
}else {
return colors[0];
}
})
.shape('fill')
.active(true)
.style({
opacity: 1
})
.render();
const citylayer2 = scene.PolygonLayer()
.source(city)
.shape('line')
.color('#fff')
.style({
opacity: 1.0
})
//.render();
console.log(citylayer);
citylayer.on('click',(e)=>{
$("#info").css({'left': e.pixel.x,'top':e.pixel.y, display:'block'});
$("#info").html(`<p>${e.feature.properties.area || e.feature.properties.name }<span">${e.feature.properties.pm2_5_24h || 0}</span></p>`);
})
$('.info-panel input').change(function(){
$(this).next().text($(this).val());
const min = $('.info-panel input').val();
const max = $($('.info-panel input')[1]).val();
citylayer.filter('pm2_5_24h',(value)=>{
return (value>=min && value<=max)
}).render();
})
$('.info-panel select').change(function(){
const color = $(this).val();
citylayer.color('pm2_5_24h',colorObj[color]).render();
console.timeEnd('color')
})
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-04_image"><!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">
<title>hexagon demo</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 121.2680, 30.3628 ],
pitch: 0,
zoom: 15,
minZoom: 4,
maxZoom: 18
});
scene.on('loaded', () => {
const imageLayer = scene.ImageLayer().
source('https://gw.alipayobjects.com/zos/rmsportal/FnHFeFklTzKDdUESRNDv.jpg',{
parser:{
type:'image',
extent: [ 121.1680, 30.2828, 121.3840, 30.4219 ]
}
})
.style({
opacity:1.0,
})
.render();
});
</script>
</body>
</html>
</textarea>
<textarea id="code-05_raster_dem"><!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">
<title>dem demo</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id = 'gui' style="position:absolute;top:0px;right:0px;z-index:2;"></div>
<div id="map"></div>
<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="./assets/geotiff.browserify.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
viewMode: '3D',
mapStyle: 'amap://styles/ba3e9759545cd618392ef073c0dfda8c?isPublic=true', // 样式URL
center: [ 110.770672, 34.159869 ],
pitch: 0,
zoom: 4
});
scene.on('loaded', () => {
const xhr = new XMLHttpRequest();
xhr.open('GET', ' https://gw.alipayobjects.com/os/rmsportal/XKgkjjGaAzRyKupCBiYW.dat', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
if (this.status === 200) {
// get binary data as a response
const blob = this.response;
const tiff = GeoTIFF.parse(blob);
const image = tiff.getImage();
const values = image.readRasters()[0];
const m = image.getHeight();
const n = image.getWidth();
const layer = scene.RasterLayer({ zIndex: 2 }).
source(values, {
parser: {
type: 'raster',
width: n,
height: m,
min: 0,
max: 8000,
extent: [ 73.482190241, 3.82501784112, 135.106618732, 57.6300459963 ]
}
})
.style({
rampColors: {
colors: [ '#002466', '#0D408C', '#105CB3', '#1A76C7', '#2894E0', '#3CB4F0', '#65CEF7', '#98E3FA', '#CFF6FF', '#E8FCFF' ],
positions: [ 0, 0.02, 0.05, 0.1, 0.2, 0.3, 0.5, 0.6, 0.8, 1.0 ]
}
})
.render();
}
};
xhr.send();
});
</script>
</body>
</html>
</textarea>
<textarea id="code-06_text"><!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">
<title>point_circle</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 120.19382669582967, 30.258134 ],
pitch: 0,
zoom: 3
});
window.scene = scene;
scene.on('loaded', () => {
$.get('./data/provincePoint.geojson', data => {
scene.PointLayer({
zIndex: 2
})
.source(data)
.shape('name', 'text')
.size(12) // default 1
.color('#fff')
.style({
stroke: '#999',
strokeWidth: 2,
opacity: 0.85
})
.render();
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-07_city"><!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>city</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id="map">
<div id ="info" class ="tooltip" style="display:none">
</div>
<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',
mapStyle: 'light', // 样式URL
center: [120.173104, 30.244072],
pitch: 66.50572,
zoom: 15.79,
minZoom:10
});
window.scene = scene;
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/rmsportal/XHMbjQwrSrajvLLvMPbK.json', data => {
scene.PolygonLayer({
zIndex: 0
})
.source(data)
.shape('fill')
.active({fill:'blue'})
.color('rgb(79,174,234)')
.render();
});
$.get('https://gw.alipayobjects.com/os/rmsportal/VifgwJEyBIXnDrjCwWdK.json', data => {
scene.PolygonLayer({
zIndex: 0
})
.source(data)
.shape('fill')
.color('rgb(156,194,116)')
.render();
});
$.get('https://gw.alipayobjects.com/os/rmsportal/ZseLNWMOPGrgqQYfvtli.json', data => {
scene.LineLayer({
zIndex: 2
})
.source(data)
.shape('line')
.size([3,0])
.color('rgb(79,174,234)')
.render();
});
$.get('https://gw.alipayobjects.com/os/rmsportal/ggFwDClGjjvpSMBIrcEx.json', data => {
citylayer = scene.PolygonLayer({
zIndex: 2
})
.source(data)
.shape('extrude')
.active({fill:'red'})
.size('floor',[10,2000])
.color('rgba(242,246,250,0.96)')
.render();
/**
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>`);
})
**/
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-08_arc_line"><!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">
<title>hexagon demo</title>
<style>
#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='https://npmcdn.com/@turf/turf/turf.min.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>
const color1 = [ 'rgba(37, 140, 249, 0.8)', 'rgba(14, 241, 242, 0.8)', 'rgba(255, 255, 255, 0.8)' ];
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 116.2825, 39.9 ],
pitch: 0,
zoom: 3
});
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt', data => {
const rows = data.split('\n');
var features =[];
for(var i =1;i<rows.length-1;i++){
var row = rows[i].split(',');
var start = turf.point([row[4], row[5]]);
var end = turf.point([row[6], row[7]]);
var greatCircle = turf.greatCircle(start, end, {'npoints': 50});
features.push(greatCircle);
}
var fc = turf.featureCollection(features);
const layer = scene.LineLayer({
zIndex: 2
})
.source(fc)
.color('rgb(13,64,140)')
.style({
opacity:0.6,
})
//.animate({enable:true})
.render();
console.log(layer);
/**
scene.LineLayer({
zIndex: 2
})
.source(data, { // lng1,lat1,lng2,lat2
type: 'csv',
x: 'lng1',
y: 'lat1',
x1: 'lng2',
y1: 'lat2'
})
.shape('arc')
.size(0.8)
.color('rgb(13,64,140)')
.style({
opacity:0.6,
})
//.animate({enable:true})
.render();
**/
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-08_point_shape"><!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">
<title>point_circle</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 120.037828998113099, 30.086317611850635 ],
pitch: 0,
zoom: 5.44
});
window.scene = scene;
var colorObj={
'黄色':'yellow',
'蓝色':'blue',
'橙色':'orange'
}
scene.on('loaded', () => {
$.get('./data/waringData.json', data => {
scene.PointLayer({
zIndex: 2
})
.source(data, {
type: 'array',
x: 'lon',
y: 'lat',
})
.shape('2d:radar')
.size(80 )
.active(false)
.color('signallevel',(v)=>{
return colorObj[v];
})
.style({
shape:'radar'
})
.render();
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-grid"><!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">
<title>point_circle</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [120.132624,30.281774],
pitch: 0,
zoom: 3.88
});
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => {
var layer = scene.HeatmapLayer({
zIndex: 2
})
.source(data, {
parser: {
type: 'csv',
x: 'lng',
y: 'lat'
},
transforms:[
{
type: 'map',
callback:function(item){
const [x, y] = item.coordinates;
item.lat = item.lat*1;
item.lng = item.lng*1;
item.v = item.v *1;
item.coordinates = [x*1,y*1];
return item;
}
},
{
type: 'grid',
size: 15000,
field:'v',
method:'sum'
}
]
})
.shape('grid')
.active({fill:'red'})
.style({
coverage: 0.8
})
.color('count', ["#002466","#105CB3","#2894E0","#CFF6FF","#FFF5B8","#FFAB5C","#F27049","#730D1C"])
.render();
console.log(layer);
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-heatmap"><!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">
<title>heatmap</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ -155, 60 ],
pitch: 0,
zoom: 4.5
});
window.scene = scene;
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/basement_prod/08c6ea00-dc5f-4bb0-b0b5-52bde5edf0a3.json', data => {
scene.HeatmapLayer({
zIndex: 2
})
.source(data)
.size('mag', [ 0, 1 ]) // weight映射通道
.style({
intensity: 100,
radius: 30,
rampColors: {
colors: [ 'rgba(33,102,172,0.0)', 'rgb(103,169,207)', 'rgb(209,229,240)', 'rgb(253,219,199)', 'rgb(239,138,98)', 'rgb(178,24,43,1.0)' ],
positions: [ 0, 0.2, 0.4, 0.6, 0.8, 1.0 ]
}
})
.render();
/*scene.PointLayer({
zIndex: 2
})
.source(data)
.shape('2d:circle')
.size(2) // weight映射通道
.color('red')
.render();*/
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-hexgon"><!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">
<title>point_circle</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [120.132624,30.281774],
pitch: 0,
zoom: 10
});
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => {
var layer = scene.HeatmapLayer({
zIndex: 2
})
.source(data, {
parser: {
type: 'csv',
x: 'lng',
y: 'lat'
},
transforms:[
{
type: 'map',
callback:function(item){
const [x, y] = item.coordinates;
item.lat = item.lat*1;
item.lng = item.lng*1;
item.v = item.v *1;
item.coordinates = [x*1,y*1];
return item;
}
},
{
type: 'hexagon',
size: 6000,
field:'v',
method:'sum'
}
]
})
.active(true)
.shape('hexagon')
.style({
coverage: 0.9,
angle: 0,
})
.color('count', ["#002466","#105CB3","#2894E0","#CFF6FF","#FFF5B8","#FFAB5C","#F27049","#730D1C"])
.render();
console.log(layer);
});
});
</script>
</body>
</html>
</textarea>
<textarea id="code-line"><!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">
<title>city demo</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id = 'gui' style="position:absolute;top:0px;right:0px;z-index:2;"></div>
<div id="map"></div>
<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="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
var buildLayer =null;
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [116.428925,39.903969 ],
pitch: 0,
zoom: 15,
minZoom: 5,
maxZoom: 18
});
scene.on('loaded', () => {
const line = {"type":"FeatureCollection",
"features":[{"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[116.379883,39.865601,0],[116.379997,39.865498,15],[116.380104,39.865364,47],[116.380203,39.865246,95],[116.380348,39.865032,170],[116.380478,39.864765,277],[116.380478,39.864765,384],[116.380745,39.864727,514],[116.381218,39.864799,685],[116.381439,39.864841,875],[116.381798,39.864906,1097],[116.382034,39.864979,1341],[116.382309,39.865093,1612],[116.383095,39.865559,1968],[116.383575,39.865742,2370],[116.383896,39.865822,2801],[116.384232,39.865871,3261],[116.384537,39.865883,3747],[116.384903,39.865868,4264],[116.385132,39.865841,4801],[116.385422,39.865761,5364],[116.385582,39.865696,5942],[116.385582,39.865696,6520],[116.385788,39.865623,7117],[116.386055,39.865517,7740],[116.38694,39.86525,8444],[116.387482,39.865128,9196],[116.387672,39.865204,9966],[116.387741,39.865391,10758],[116.387772,39.865475,11560],[116.387901,39.866009,12422],[116.387955,39.866352,13322],[116.38797,39.866581,14248],[116.38797,39.867085,15230],[116.38797,39.867371,16244],[116.387947,39.867935,17321],[116.387939,39.868587,18471],[116.387932,39.869381,19709],[116.387932,39.870155,21033],[116.387901,39.870506,22396],[116.387901,39.870506,23759],[116.388077,39.870682,25147],[116.388222,39.870762,26550],[116.388275,39.870773,27958],[116.388542,39.87077,29389],[116.389153,39.870762,30872],[116.390015,39.870762,32429],[116.390114,39.870777,33995],[116.39019,39.870804,35568],[116.390259,39.870827,37147],[116.390755,39.87112,38779],[116.390961,39.871201,40431],[116.392235,39.871254,42192],[116.392296,39.871258,43958],[116.394577,39.871346,45919],[116.395042,39.871368,47920],[116.395279,39.871368,49941],[116.396156,39.871372,52037],[116.396156,39.871372,54133],[116.397476,39.871574,56344],[116.398438,39.871616,58637],[116.399734,39.871685,61041],[116.400322,39.871693,63495],[116.401268,39.871746,66030],[116.402931,39.871826,68707],[116.403282,39.871861,71414],[116.404373,39.871948,74215],[116.405106,39.87196,77079],[116.406166,39.871979,80034],[116.40712,39.872005,83071],[116.40934,39.872074,86298],[116.411125,39.872124,89678],[116.411407,39.872135,93082],[116.413887,39.872189,96698],[116.414276,39.8722,100347],[116.414642,39.872192,104027],[116.414818,39.872177,107722],[116.415344,39.872074,111463],[116.415779,39.871899,115246],[116.41687,39.871395,119138],[116.417328,39.871201,123075],[116.417603,39.871124,127037],[116.417801,39.87109,131016],[116.418159,39.871048,135026],[116.418488,39.87104,139064],[116.419136,39.871075,143157],[116.419708,39.871113,147299],[116.419891,39.87112,151457],[116.420082,39.87114,155631],[116.420425,39.871159,159834],[116.420761,39.871178,164066],[116.420853,39.871185,168306],[116.420944,39.871193,172554],[116.421066,39.871201,176812],[116.421219,39.871201,181083],[116.421257,39.871208,185357],[116.421883,39.871246,189685],[116.421883,39.871246,194013],[116.42202,39.871201,198354],[116.422081,39.87117,202701],[116.422127,39.871124,207054],[116.422195,39.871033,211419],[116.422226,39.870586,215834],[116.422211,39.870533,220255],[116.422188,39.870476,224683],[116.422142,39.87043,229117],[116.422081,39.87038,233559],[116.421997,39.87035,238009],[116.421867,39.87035,242470],[116.421783,39.870361,246938],[116.421715,39.870388,251413],[116.42157,39.870453,255902],[116.421501,39.870502,260399],[116.421501,39.870502,264896],[116.421486,39.870792,269425],[116.421478,39.870861,273962],[116.421455,39.871437,278563],[116.421425,39.872169,283246],[116.421379,39.873272,288052],[116.421326,39.874275,292970],[116.42131,39.875,297969],[116.421295,39.87532,303004],[116.421272,39.875843,308097],[116.421219,39.876854,313303],[116.42112,39.878708,318716],[116.42112,39.878853,324145],[116.421051,39.880367,329743],[116.421028,39.880692,335377],[116.421021,39.880863,341030],[116.421013,39.880928,346690],[116.421005,39.881634,352429],[116.420952,39.882782,358296],[116.420944,39.88303,364191],[116.420914,39.883743,370165],[116.420906,39.883854,376151],[116.420898,39.883934,382146],[116.42083,39.884594,388215],[116.420784,39.884773,394304],[116.420723,39.884964,400415],[116.420486,39.885441,406583],[116.420471,39.885475,412755],[116.419678,39.88699,419109],[116.419647,39.887062,425471],[116.419304,39.887848,431925],[116.41925,39.888035,438400],[116.419197,39.888264,444901],[116.419167,39.888504,451429],[116.419144,39.888882,457999],[116.419128,39.889191,464603],[116.419075,39.890392,471341],[116.419075,39.890545,478096],[116.419052,39.890923,484893],[116.419029,39.891357,491738],[116.419014,39.89204,498659],[116.419029,39.89259,505641],[116.419037,39.892956,512664],[116.419029,39.893246,519719],[116.418999,39.893608,526814],[116.418961,39.893852,533936],[116.418915,39.894402,541119],[116.418915,39.894592,548323],[116.418846,39.895786,555660],[116.4188,39.897121,563146],[116.4188,39.897209,570642],[116.418709,39.899338,578375],[116.418663,39.900223,586207],[116.418655,39.900414,594060],[116.418571,39.901062,601985],[116.418556,39.901173,609922],[116.418533,39.901489,617894],[116.418526,39.90163,625882],[116.418488,39.902054,633917],[116.418465,39.902344,641984],[116.418442,39.902649,650085],[116.418434,39.902706,658192],[116.418434,39.903198,666354],[116.418419,39.903553,674556],[116.418365,39.904186,682829],[116.418335,39.904579,691146],[116.418327,39.904858,699494],[116.41832,39.905056,707864],[116.418312,39.905304,716262],[116.418266,39.906265,724767],[116.418121,39.908184,733486],[116.418121,39.908184,742205],[116.420853,39.908241,751157],[116.421234,39.908241,760142],[116.422356,39.90826,769223],[116.422928,39.908272,778353],[116.42334,39.908279,787518],[116.423454,39.908283,796693],[116.424446,39.908283,805953],[116.424522,39.908283,815219],[116.425194,39.908302,824542],[116.426964,39.908337,834016],[116.426964,39.908337,843490],[116.426987,39.908001,853001],[116.42701,39.907352,862584],[116.427032,39.906639,872246],[116.427048,39.906246,881952],[116.427055,39.905941,891692],[116.427063,39.90509,901527],[116.427238,39.904968,911382],[116.42746,39.904915,921257],[116.428894,39.904907,931254],[116.428894,39.904907,941251],[116.428909,39.904835,951256],[116.428925,39.904427,961306],[116.428963,39.904129,971389],[116.428963,39.904129,981472],[116.428909,39.90406,991564],[116.428925,39.903969,1001666],[116.42894,39.90329,1011844],[116.42894,39.90329,1022022],[116.427841,39.903244,1032294],[116.427299,39.903233,1042612]]}}]};
const linelayer = scene.LineLayer({
zIndex: 2
})
.shape('line')
.size([2,0])
.source(line)
.color('#ff893a')
.animate({
enable:true,
interval:1,
duration:2,
trailLength:0.1,
repeat:1,
})
.render();
linelayer.on('animateEnd',()=>{
scene.removeLayer(linelayer);
//linelayer.hide();
})
})
</script>
</body>
</html>
</textarea>
<textarea id="code-mapbox"><!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>point_circle</title>
<style>
body {
margin:0;
padding:0;
}
#map { position:absolute; top:0; bottom:0; width:100%; margin:0; }
</style>
</head>
<body>
<div id="map"></div>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.34.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.34.0/mapbox-gl.css' rel='stylesheet' />
<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>
const colorObj ={
blue: ["#E8FCFF", "#CFF6FF", "#A1E9ff", "#65CEF7", "#3CB1F0", "#2894E0", "#1772c2", "#105CB3", "#0D408C", "#002466"].reverse(),
red: ["#FFF4F2", "#FFDFDB", "#FAADAA", "#F77472", "#F04850", "#D63147", "#BD223E", "#A81642", "#820C37", "#5C0023"].reverse(),
orange:["#FFF7EB", "#FFECD4", "#FAD09D", "#F7B16A", "#F08D41", "#DB6C2C", "#C2491D", "#AD2B11", "#871D0C", "#610800"].reverse(),
green:["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"].reverse(),
yellow:["#FFFFE8", "#FFFECC", "#FAF896", "#F7E463", "#F0CE3A", "#DBB125", "#C29117", "#AD7410", "#87500C", "#613000"].reverse(),
purple:["#FCF2FF", "#F5DEFF", "#DDB3F2", "#BE7BE3", "#9B4ECF", "#7737B3", "#5B2899", "#411C85", "#270F5E", "#100338"].reverse()
}
const scene = new L7.Scene({
container: 'map',
mapType:'mapbox',
style: 'mapbox://styles/mapbox/streets-v9', // stylesheet location
center: [ 120.19382669582967, 30.258134 ],
pitch: 0,
hash:true,
zoom: 1,
});
window.scene = scene;
scene.on('loaded', () => {
var colors = ["#FFF5B8","#FFDC7D","#FFAB5C","#F27049","#D42F31","#730D1C"];
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/JToMOWvicvJOISZFCkEI.json', city => {
const citylayer = scene.PolygonLayer()
.source(city)
//.color('pm2_5_24h',["#FFF5B8","#FFDC7D","#FFAB5C","#F27049","#D42F31","#730D1C"])
.color('pm2_5_24h',(p)=>{
if(p>120){
return colors[5];
} else if(p>65){
return colors[4];
} else if(p>30) {
return colors[3];
} else if(p>15){
return colors[2];
} else if(p>8){
return colors[1];
}else {
return colors[0];
}
})
.shape('fill')
.active(true)
.style({
opacity: 1
})
.render();
console.log('success');
});
$.get('https://gw.alipayobjects.com/os/rmsportal/ggFwDClGjjvpSMBIrcEx.json', data => {
citylayer = scene.PolygonLayer({
zIndex: 2
})
.source(data)
.shape('extrude')
.active({fill:'red'})
.size('floor',[0.1,1])
.color('#aaa')
.render();
})
});
</script>
</body>
</html>
</textarea>
<textarea id="code-meshline"><!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">
<title>line demo</title>
<style>
#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/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 120.3672, 36.0968 ],
pitch: 0,
zoom: 13
});
scene.on('loaded', () => {
$.getJSON('./data/contour.json', contourData => {
const color = [ 'rgb(22,32,101)', 'rgb(28,43,127)', 'rgb(36,68,142)', 'rgb(45,94,158)', 'rgb(53,119,174)', 'rgb(61,145,190)', 'rgb(70,170,206)', 'rgb(98,190,210)', 'rgb(138,205,206)', 'rgb(179,221,204)', 'rgb(220,236,201)' ];
//contourData.features = contourData.features.slice(0,1);
const layer = scene.LineLayer()
.source(contourData)
.color('ELEV', color)
.size([ 1, 0 ])
.shape('meshLine')
.render();
});
})
</script>
</body>
</html>
</textarea>
<textarea id="code-taxi"><!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">
<title>city demo</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id = 'gui' style="position:absolute;top:0px;right:0px;z-index:2;"></div>
<div id="map"></div>
<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="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
var buildLayer =null;
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 121.507674, 31.223043 ],
pitch: 65.59312320916906,
zoom: 16.4,
minZoom: 15,
maxZoom: 18
});
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/rmsportal/kNDVHmyUWAKhWmWXmjxM.json', data => {
scene.LineLayer({
zIndex: 2
})
.source(data)
//.color('#F08D41')
.color('#ff893a')
.animate({enable:true})
.render();
});
$.get('https://gw.alipayobjects.com/os/rmsportal/vmvAxgsEwbpoSWbSYvix.json', data => {
buildLayer = scene.PolygonLayer({
zIndex: 2
})
.source(data)
.shape('extrude')
.size('floor',[0,2000])
.color('rgba(242,246,250,1.0)')
.animate({enable:true})
.style({
opacity:1.0,
baseColor:'rgb(16,16,16)',
windowColor:'rgb(30,60,89)',
//brightColor:'rgb(155,217,255)'
brightColor:'rgb(255,176,38)'
})
.render();
});
});
function changeStyle(e){
buildLayer.style({
opacity:0.8,
baseColor:palette.baseColor,
windowColor:palette.windowColor,
brightColor:palette.brightColor,
}
).render();
}
</script>
</body>
</html>
</textarea>
</div>
<div class="main">
<div class="container filter">
<input id="query" class="form-control" type="text" placeholder="search">
</div>
<div class="row demo-thumbnails">
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="01_point_circle">
<div class="card">
<a href="#/01_point_circle" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/01_point_circle.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/01_point_circle">01_point_circle</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="01_point_column">
<div class="card">
<a href="#/01_point_column" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/01_point_column.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/01_point_column">01_point_column</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="01_point_distribute">
<div class="card">
<a href="#/01_point_distribute" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/01_point_distribute.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/01_point_distribute">01_point_distribute</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="01_point_image">
<div class="card">
<a href="#/01_point_image" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/01_point_image.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/01_point_image">01_point_image</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="02_contour">
<div class="card">
<a href="#/02_contour" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/02_contour.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/02_contour">02_contour</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="02_oneBletoneRoad">
<div class="card">
<a href="#/02_oneBletoneRoad" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/02_oneBletoneRoad.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/02_oneBletoneRoad">02_oneBletoneRoad</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="03_1_extrude_polygon">
<div class="card">
<a href="#/03_1_extrude_polygon" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/03_1_extrude_polygon.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/03_1_extrude_polygon">03_1_extrude_polygon</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="03_choropleths_polygon">
<div class="card">
<a href="#/03_choropleths_polygon" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/03_choropleths_polygon.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/03_choropleths_polygon">03_choropleths_polygon</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="04_image">
<div class="card">
<a href="#/04_image" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/04_image.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/04_image">04_image</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="05_raster_dem">
<div class="card">
<a href="#/05_raster_dem" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/05_raster_dem.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/05_raster_dem">05_raster_dem</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="06_text">
<div class="card">
<a href="#/06_text" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/06_text.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/06_text">06_text</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="07_city">
<div class="card">
<a href="#/07_city" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/07_city.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/07_city">07_city</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="08_arc_line">
<div class="card">
<a href="#/08_arc_line" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/08_arc_line.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/08_arc_line">08_arc_line</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="08_point_shape">
<div class="card">
<a href="#/08_point_shape" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/08_point_shape.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/08_point_shape">08_point_shape</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="grid">
<div class="card">
<a href="#/grid" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/grid.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/grid">grid</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="heatmap">
<div class="card">
<a href="#/heatmap" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/heatmap.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/heatmap">heatmap</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="hexgon">
<div class="card">
<a href="#/hexgon" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/hexgon.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/hexgon">hexgon</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="line">
<div class="card">
<a href="#/line" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/line.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/line">line</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="mapbox">
<div class="card">
<a href="#/mapbox" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/mapbox.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/mapbox">mapbox</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="meshline">
<div class="card">
<a href="#/meshline" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/meshline.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/meshline">meshline</a></h6>
</div>
</div>
</div>
<div class="demo-thumbnail col-md-4 col-sm-6 col-xs-12 text-center" data-basename="taxi">
<div class="card">
<a href="#/taxi" class="thumbnail-container">
<img src="/datavis/L7/demos/assets/screenshots/taxi.png" alt="">
</a>
<div class="card-body">
<h6> <a style="font-size: 25px;" href="#/taxi">taxi</a></h6>
</div>
</div>
</div>
</div>
<div id="doc-container" style="display:none;">
<div class="code-panel" id="code-panel">
<div class="code-banner">
<a class="btn btn-light" href="#">back</a>
<button id="execute" class="btn btn-primary">execute</button>
<button id="copy-code" class="btn btn-light">copy</button>
</div>
<div class="code-editor">
<textarea name="code" id="code"></textarea>
</div>
</div>
<div id="resize-handler"></div>
<div id="chart-panel" class="preview"></div>
</div>
</div>
<script src="./assets/codemirror-5.29.0/codemirror-merged.min.js"></script>
<script src="./assets/lodash-4.17.4.min.js"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="./assets/jquery.resizable-0.20.0.js"></script>
<script src="./assets/popper.js-1.12.5/popper.min.js"></script>
<script src="./assets/bootstrap-4.1.0/bootstrap.min.js"></script>
<script src="./assets/clipboard-1.7.1.min.js"></script>
<script src="./assets/routie-0.3.2.min.js"></script>
<script src="./assets/index.js"></script>
</body>
</html>