-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'grid-heatMap' into 'master'
Grid heat map 增加mapbox 增加多边形热力图 See merge request !5
- Loading branch information
Showing
68 changed files
with
2,735 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,6 @@ lib | |
|
||
*.sw* | ||
*.un~ | ||
demos/mapbox.html | ||
demos/gd.html | ||
demos/data | ||
demos/image | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!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: 4, | ||
maxZoom:14, | ||
minZoom:4, | ||
}); | ||
window.scene = scene; | ||
scene.on('loaded', () => { | ||
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => { | ||
|
||
|
||
const circleLayer = scene.PointLayer({ | ||
zIndex: 2 | ||
}) | ||
.source(data,{ | ||
type: 'csv', | ||
x: 'lng', | ||
y: 'lat', | ||
}) | ||
.size(1.0) | ||
.color('#0D408C') | ||
.style({ | ||
stroke: 'rgb(255,255,255)', | ||
strokeWidth: 1, | ||
opacity: 1. | ||
}) | ||
.render(); | ||
|
||
circleLayer.on('click',(e)=>{ | ||
console.log(e); | ||
}) | ||
}); | ||
|
||
}); | ||
|
||
</script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!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('gird') | ||
.style({ | ||
coverage: 0.8 | ||
}) | ||
.color('count', ["#002466","#105CB3","#2894E0","#CFF6FF","#FFF5B8","#FFAB5C","#F27049","#730D1C"]) | ||
.render(); | ||
console.log(layer); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<!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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.