-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
178 additions
and
42 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { HeatmapLayer, Scene } from '@antv/l7'; | ||
import * as allMap from '@antv/l7-maps'; | ||
|
||
export function MapRender(option: { map: string; renderer: string }) { | ||
const scene = new Scene({ | ||
id: 'map', | ||
renderer: option.renderer === 'device' ? 'device' : 'regl', | ||
enableWebGPU: true, | ||
shaderCompilerPath: '/glsl_wgsl_compiler_bg.wasm', | ||
map: new allMap[option.map || 'Map']({ | ||
style: 'light', | ||
center: [121.434765, 31.256735], | ||
zoom: 14.83, | ||
}), | ||
}); | ||
|
||
scene.on('loaded', () => { | ||
fetch( | ||
'https://gw.alipayobjects.com/os/basement_prod/513add53-dcb2-4295-8860-9e7aa5236699.json', | ||
) | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
const layer = new HeatmapLayer({ autoFit: true }) | ||
.source(data, { | ||
transforms: [ | ||
{ | ||
type: 'hexagon', | ||
size: 100, | ||
field: 'h12', | ||
method: 'sum', | ||
}, | ||
], | ||
}) | ||
.size('sum', [0, 60]) | ||
.shape('squareColumn') | ||
.style({ | ||
opacity: 1, | ||
}) | ||
.color( | ||
'sum', | ||
[ | ||
'#094D4A', | ||
'#146968', | ||
'#1D7F7E', | ||
'#289899', | ||
'#34B6B7', | ||
'#4AC5AF', | ||
'#5FD3A6', | ||
'#7BE39E', | ||
'#A1EDB8', | ||
'#CEF8D6', | ||
].reverse(), | ||
); | ||
scene.startAnimate(); | ||
scene.addLayer(layer); | ||
scene.render(); | ||
}); | ||
}); | ||
} |
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,64 @@ | ||
import { HeatmapLayer, Scene } from '@antv/l7'; | ||
import * as allMap from '@antv/l7-maps'; | ||
|
||
export function MapRender(option: { map: string; renderer: string }) { | ||
const scene = new Scene({ | ||
id: 'map', | ||
renderer: option.renderer === 'device' ? 'device' : 'regl', | ||
enableWebGPU: true, | ||
shaderCompilerPath: '/glsl_wgsl_compiler_bg.wasm', | ||
map: new allMap[option.map || 'Map']({ | ||
style: 'light', | ||
center: [121.434765, 31.256735], | ||
zoom: 14.83, | ||
}), | ||
}); | ||
|
||
scene.on('loaded', () => { | ||
fetch( | ||
'https://gw.alipayobjects.com/os/basement_prod/d3564b06-670f-46ea-8edb-842f7010a7c6.json', | ||
) | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
const layer = new HeatmapLayer({ autoFit: true }) | ||
.source(data, { | ||
transforms: [ | ||
{ | ||
type: 'grid', | ||
size: 150000, | ||
field: 'mag', | ||
method: 'sum', | ||
}, | ||
], | ||
}) | ||
.size('sum', (sum) => { | ||
return sum * 2000; | ||
}) | ||
.shape('hexagonColumn') | ||
.style({ | ||
coverage: 0.8, | ||
angle: 0, | ||
}) | ||
.color( | ||
'count', | ||
[ | ||
'#0B0030', | ||
'#100243', | ||
'#100243', | ||
'#1B048B', | ||
'#051FB7', | ||
'#0350C1', | ||
'#0350C1', | ||
'#0072C4', | ||
'#0796D3', | ||
'#2BA9DF', | ||
'#30C7C4', | ||
'#6BD5A0', | ||
'#A7ECB2', | ||
'#D0F4CA', | ||
].reverse(), | ||
); | ||
scene.addLayer(layer); | ||
}); | ||
}); | ||
} |
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
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
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