|
|
|
@ -48,7 +48,7 @@
|
|
|
|
|
import { onMounted, onUnmounted, defineProps, reactive, ref, defineExpose } from 'vue';
|
|
|
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
|
|
|
import { Map, Popup } from 'mapbox-gl';
|
|
|
|
|
|
|
|
|
|
import heatGeoJson from './lib/data.json'
|
|
|
|
|
|
|
|
|
|
// 图形绘制工具类
|
|
|
|
|
import MapboxDraw from '@mapbox/mapbox-gl-draw';
|
|
|
|
@ -205,81 +205,81 @@
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// map.addSource('earthquakes', {
|
|
|
|
|
// 'type': 'geojson',
|
|
|
|
|
// 'data': {}
|
|
|
|
|
// });
|
|
|
|
|
map.addSource('earthquakes', {
|
|
|
|
|
'type': 'geojson',
|
|
|
|
|
'data': heatGeoJson
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// map.addLayer(
|
|
|
|
|
// {
|
|
|
|
|
// 'id': 'earthquakes-heat',
|
|
|
|
|
// 'type': 'heatmap',
|
|
|
|
|
// 'source': 'earthquakes',
|
|
|
|
|
// // 'maxzoom': 18,
|
|
|
|
|
// 'minzoom':11,
|
|
|
|
|
// 'paint': {
|
|
|
|
|
// // Increase the heatmap weight based on frequency and property magnitude
|
|
|
|
|
// 'heatmap-weight': [
|
|
|
|
|
// 'interpolate',
|
|
|
|
|
// ['linear'],
|
|
|
|
|
// ['get', 'mag'],
|
|
|
|
|
// 0,
|
|
|
|
|
// 1,
|
|
|
|
|
// 1,
|
|
|
|
|
// 0
|
|
|
|
|
// ],
|
|
|
|
|
// // Increase the heatmap color weight weight by zoom level
|
|
|
|
|
// // heatmap-intensity is a multiplier on top of heatmap-weight
|
|
|
|
|
// 'heatmap-intensity': [
|
|
|
|
|
// 'interpolate',
|
|
|
|
|
// ['linear'],
|
|
|
|
|
// ['zoom'],
|
|
|
|
|
// 0,
|
|
|
|
|
// 1,
|
|
|
|
|
// 9,
|
|
|
|
|
// 3
|
|
|
|
|
// ],
|
|
|
|
|
// // Color ramp for heatmap. Domain is 0 (low) to 1 (high).
|
|
|
|
|
// // Begin color ramp at 0-stop with a 0-transparancy color
|
|
|
|
|
// // to create a blur-like effect.
|
|
|
|
|
// 'heatmap-color': [
|
|
|
|
|
// 'interpolate',
|
|
|
|
|
// ['linear'],
|
|
|
|
|
// ['heatmap-density'],
|
|
|
|
|
// 0,
|
|
|
|
|
// 'rgba(33,102,172,0)',
|
|
|
|
|
// 0.2,
|
|
|
|
|
// 'rgb(103,169,207)',
|
|
|
|
|
// 0.4,
|
|
|
|
|
// 'rgb(209,229,240)',
|
|
|
|
|
// 0.6,
|
|
|
|
|
// 'rgb(253,219,199)',
|
|
|
|
|
// 0.8,
|
|
|
|
|
// 'rgb(239,138,98)',
|
|
|
|
|
// 1,
|
|
|
|
|
// 'rgb(178,24,43)'
|
|
|
|
|
// ],
|
|
|
|
|
// // Adjust the heatmap radius by zoom level
|
|
|
|
|
// 'heatmap-radius': [
|
|
|
|
|
// 'interpolate',['linear'],['zoom'],
|
|
|
|
|
// 3,
|
|
|
|
|
// 6,
|
|
|
|
|
// 9,
|
|
|
|
|
// 20
|
|
|
|
|
// ],
|
|
|
|
|
// // Transition from heatmap to circle layer by zoom level
|
|
|
|
|
// 'heatmap-opacity': [
|
|
|
|
|
// 'interpolate',
|
|
|
|
|
// ['linear'],
|
|
|
|
|
// ['zoom'],
|
|
|
|
|
// 7,
|
|
|
|
|
// 1,
|
|
|
|
|
// 8,
|
|
|
|
|
// 1
|
|
|
|
|
// ]
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// );
|
|
|
|
|
map.addLayer(
|
|
|
|
|
{
|
|
|
|
|
'id': 'earthquakes-heat',
|
|
|
|
|
'type': 'heatmap',
|
|
|
|
|
'source': 'earthquakes',
|
|
|
|
|
// 'maxzoom': 18,
|
|
|
|
|
'minzoom':11,
|
|
|
|
|
'paint': {
|
|
|
|
|
// Increase the heatmap weight based on frequency and property magnitude
|
|
|
|
|
'heatmap-weight': [
|
|
|
|
|
'interpolate',
|
|
|
|
|
['linear'],
|
|
|
|
|
['get', 'mag'],
|
|
|
|
|
0,
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
0
|
|
|
|
|
],
|
|
|
|
|
// Increase the heatmap color weight weight by zoom level
|
|
|
|
|
// heatmap-intensity is a multiplier on top of heatmap-weight
|
|
|
|
|
'heatmap-intensity': [
|
|
|
|
|
'interpolate',
|
|
|
|
|
['linear'],
|
|
|
|
|
['zoom'],
|
|
|
|
|
0,
|
|
|
|
|
1,
|
|
|
|
|
9,
|
|
|
|
|
3
|
|
|
|
|
],
|
|
|
|
|
// Color ramp for heatmap. Domain is 0 (low) to 1 (high).
|
|
|
|
|
// Begin color ramp at 0-stop with a 0-transparancy color
|
|
|
|
|
// to create a blur-like effect.
|
|
|
|
|
'heatmap-color': [
|
|
|
|
|
'interpolate',
|
|
|
|
|
['linear'],
|
|
|
|
|
['heatmap-density'],
|
|
|
|
|
0,
|
|
|
|
|
'rgba(33,102,172,0)',
|
|
|
|
|
0.2,
|
|
|
|
|
'rgb(103,169,207)',
|
|
|
|
|
0.4,
|
|
|
|
|
'rgb(209,229,240)',
|
|
|
|
|
0.6,
|
|
|
|
|
'rgb(253,219,199)',
|
|
|
|
|
0.8,
|
|
|
|
|
'rgb(239,138,98)',
|
|
|
|
|
1,
|
|
|
|
|
'rgb(178,24,43)'
|
|
|
|
|
],
|
|
|
|
|
// Adjust the heatmap radius by zoom level
|
|
|
|
|
'heatmap-radius': [
|
|
|
|
|
'interpolate',['linear'],['zoom'],
|
|
|
|
|
3,
|
|
|
|
|
6,
|
|
|
|
|
9,
|
|
|
|
|
20
|
|
|
|
|
],
|
|
|
|
|
// Transition from heatmap to circle layer by zoom level
|
|
|
|
|
'heatmap-opacity': [
|
|
|
|
|
'interpolate',
|
|
|
|
|
['linear'],
|
|
|
|
|
['zoom'],
|
|
|
|
|
7,
|
|
|
|
|
1,
|
|
|
|
|
8,
|
|
|
|
|
1
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|