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

请问怎么使地图到合适的中心点和缩放大小呢 #1891

Closed
KuduroJS opened this issue Sep 25, 2023 · 3 comments
Closed

请问怎么使地图到合适的中心点和缩放大小呢 #1891

KuduroJS opened this issue Sep 25, 2023 · 3 comments
Assignees

Comments

@KuduroJS
Copy link

比如点状地图,但是点的位置和数量是不确定的,这些点可能集中在某市,也可能集中在某省,也可能遍布全国。
所以中心点和zoom大小要根据实际数据来确定。
中心点是比较容易计算的,但缩放大小该如何计算呢,我并不知道zoom对应的比例尺,该怎么处理呢,zoom不需要很精确。
官方这边有什么建议吗?
谢谢。

@github-actions
Copy link
Contributor

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

@heiyexing
Copy link
Contributor

heiyexing commented Sep 25, 2023

PointLayer options 中的 autoFit 配置传 true,后续给 PointLayer 设置数据的时候,地图会自动移动和缩放。
如果需要更自由操作地图移动和缩放,可以使用 ScenefitBoundssetZoomAndCenter 等方法。

@KuduroJS
Copy link
Author

@heiyexing 非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants