antvis / L7

🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis engine.
https://l7.antv.antgroup.com
MIT License
3.56k stars 626 forks source link

地图初始化不显示 #2508

Closed taofeifanIT closed 1 month ago

taofeifanIT commented 1 month ago

export default function OrderMap() { useEffect(() => { const scene = new Scene({ id: 'map', map: new GaodeMap({ pitch: 66.02383, center: [121.400257, 31.25287], zoom: 14.55, rotation: 134.95, }), }); scene.on('loaded', () => { fetch('https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json') .then((res) => res.json()) .then((data) => { const pointLayer = new PointLayer({}) .source(data, { parser: { type: 'json', x: 'longitude', y: 'latitude', }, }) .animate(true) .active(true) .shape('name', ['cylinder', 'triangleColumn', 'hexagonColumn', 'squareColumn']) .size('unit_price', (h) => { return [6, 6, h / 500]; }) .color('name', ['#739DFF', '#61FCBF', '#FFDE74', '#FF896F']);

                scene.addLayer(pointLayer);
            });
    });

}, [])
return <div style={{
    // background: 'white',
    boxShadow: '0 0 10px 0 rgba(0, 0, 0, 0.1)',
    borderRadius: '5px',
    height: '470px',
}}>
    <div id='map' />
</div>

}`

github-actions[bot] commented 1 month ago

hi @taofeifanIT, welcome!

github-actions[bot] commented 1 month ago

Hi @taofeifanIT, Please star this repo if you find it useful! Thanks :star:! 你好~ @taofeifanIT 🌟 如果这个仓库对你有帮助,可以给我们点个star支持一下~你的支持对我们来说是最大的鼓励,感谢你的支持与点赞 🌟

lvisei commented 1 month ago

代码块编辑一下,阅读起来方便些 @taofeifanIT

https://docs.github.com/zh/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

lvisei commented 1 month ago

配置高德地图作为底图时,需配置 key