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

geojson位置偏移 #1890

Closed
wy2123726 opened this issue Sep 25, 2023 · 7 comments
Closed

geojson位置偏移 #1890

wy2123726 opened this issue Sep 25, 2023 · 7 comments
Assignees
Labels
good first issue Good for newcomers 👀 need more info issue 需要提供更多描述信息

Comments

@wy2123726
Copy link

请问L7如何对已经写好了的geojson数据进行位置偏移的操作?

@github-actions
Copy link
Contributor

hi @wy2123726, welcome!

@github-actions
Copy link
Contributor

Hi @wy2123726, Please star this repo if you find it useful! Thanks ⭐!
你好 @wy2123726。如果该仓库对你有用,可以 star 一下,感谢你的 ⭐!

@github-actions github-actions bot added the good first issue Good for newcomers label Sep 25, 2023
@lzxue lzxue added the 👀 need more info issue 需要提供更多描述信息 label Sep 25, 2023
@github-actions
Copy link
Contributor

Hello @wy2123726. 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.

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

@wy2123726
Copy link
Author

比如:
import { Scene, PointLayer } from "@antv/l7";
import { GaodeMap } from "@antv/l7-maps";

const scene = new Scene({
id: "map",
map: new GaodeMap({
pitch: 0,
style: "dark",
center: [114.30, 30.50],
zoom: 9,
})
});

// 标准的geojson数据
const data = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [114.30, 30.50]
},
properties: {
name: '武汉'
}
}
]
}

scene.on('loaded', () => {

let point_layer = new PointLayer()
point_layer.source(data)
  .size(30)// size相当于半径
  .color('#ff2d51')
  .shape('circle')
scene.addLayer(point_layer)

})

地图会出现一个红点,我如何不改变data值,只操作L7让这个红点往右偏移0.1°?

@lzxue
Copy link
Contributor

lzxue commented Sep 25, 2023

更新一下经纬度,setdata 更新图层

@wy2123726
Copy link
Author

就是说还是得对data进行操作,并不能用L7的API函数进行操作,因为这是一个简单的例子,如果是大量数据的整体偏移,如果遍历data会造成浏览器卡顿,L7有没有API函数进行偏移操作并且不卡顿?

@lzxue
Copy link
Contributor

lzxue commented Sep 25, 2023

只能通过更新数据,然后setData https://l7.antv.antgroup.com/api/source/source#setdata

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 more info issue 需要提供更多描述信息
Projects
None yet
Development

No branches or pull requests

2 participants