Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

热力图无法渲染 #2160

Closed
Raymond1030 opened this issue Dec 12, 2023 · 4 comments
Closed

热力图无法渲染 #2160

Raymond1030 opened this issue Dec 12, 2023 · 4 comments
Assignees
Labels
good first issue Good for newcomers 🤔 need reproduce issue 需要一个在线复现链接

Comments

@Raymond1030
Copy link

我只有一组点数据,我只是想单纯根据点密度进行热力图渲染,我是使用了我自己的Mapbox地图实例之后进行渲染,但是热力图格式一直在报错。我能确保底图是正常的,GetJson是正常读入的。
L7通过CDN引入

数据:村子_new.json
报错:l7:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'positions')
代码:
const scene = new L7.Scene({
id: 'map',
map: new L7.Mapbox({
mapInstance: map,
}),
});

scene.on('loaded', async () => {
    // 异步获取数据
    const population = getJson('../data/人口/村子_new.json');
    const heatmapLayer = new L7.HeatmapLayer({})
    .source(population)
    .shape('heatmap')
    .size(1) // 固定大小
    .style({
        intensity: 1, // 热力强度
        radius: 20,   // 半径大小
        opacity: 1.0, // 不透明度
        // 其他样式设置
    });

scene.addLayer(heatmapLayer);
Copy link
Contributor

hi @Raymond1030, welcome!

@github-actions github-actions bot added the good first issue Good for newcomers label Dec 12, 2023
@lzxue
Copy link
Contributor

lzxue commented Dec 13, 2023

你 getjson 异步写法不需要写 await 吗

@lzxue lzxue added the 🤔 need reproduce issue 需要一个在线复现链接 label Dec 18, 2023
Copy link
Contributor

Hello @Raymond1030. Please provide a online reproduction by forking codesandbox of @antv/l7 demo template Issues labeled by Need Reproduce will be closed if no activities in 3 days.

你好 @Raymond1030, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 @antv/l7 demo 模板 3 天内未跟进此 issue 将会被自动关闭。

@Raymond1030
Copy link
Author

我的getjson函数已经包含了,不用担心异步,数据已经成功读入

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers 🤔 need reproduce issue 需要一个在线复现链接
Projects
None yet
Development

No branches or pull requests

3 participants