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

如何获取每个国家中心点坐标呢 #15

Closed
andyyxw opened this issue Oct 11, 2024 · 3 comments
Closed

如何获取每个国家中心点坐标呢 #15

andyyxw opened this issue Oct 11, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@andyyxw
Copy link

andyyxw commented Oct 11, 2024

在绘制散点图的时候需要代表国家的一个坐标

@Surbowl Surbowl added the question Further information is requested label Oct 11, 2024
@andyyxw
Copy link
Author

andyyxw commented Oct 11, 2024

通过当前world.zh.json里的数据能不能计算出来?

@andyyxw
Copy link
Author

andyyxw commented Oct 11, 2024

通过当前world.zh.json里的数据能不能计算出来?

还真可以:https://turfjs.org/docs/api/centroid

@Surbowl
Copy link
Owner

Surbowl commented Oct 11, 2024

感谢您为大家提供解决思路❤️。
Turf.js 提供的 turf.centroid 函数能直接计算质心,质心是几何图形的中心点,考虑了整个形状的面积分布,确实能满足您的需求。

@Surbowl Surbowl closed this as completed Oct 11, 2024
@Surbowl Surbowl pinned this issue Oct 12, 2024
@Surbowl Surbowl added documentation Improvements or additions to documentation and removed question Further information is requested labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants