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

使用GeoUtils.getPolygonArea方法计算面积时会报错 #45

Open
guozhl opened this issue Sep 8, 2022 · 1 comment
Open

使用GeoUtils.getPolygonArea方法计算面积时会报错 #45

guozhl opened this issue Sep 8, 2022 · 1 comment

Comments

@guozhl
Copy link

guozhl commented Sep 8, 2022

问题描述:

使用DrawingManager画多边形的时候,如果一直在一个地方点击鼠标,最后得到覆盖物的坐标数组会有很多个连续相同的坐标。然后使用GeoUtils.getPolygonArea方法计算面积得到的结果是NaN

坐标示例:

[{"lng":116.05931967048495,"lat":39.94503428079636}, {"lng":116.10761257470138,"lat":39.94149394355425}, {"lng":116.10761257470138,"lat":39.94149394355425}, {"lng":116.1064627436486,"lat":39.92688810062903}, {"lng":116.08749053127787,"lat":39.91050811648429}, {"lng":116.08749053127787,"lat":39.91050811648429}, {"lng":116.06851831890714,"lat":39.9144928004373}, {"lng":116.06851831890714,"lat":39.9144928004373}, {"lng":116.05931967048495,"lat":39.94503428079636}]

使用的js

//mapopen.cdn.bcebos.com/github/BMapGLLib/GeoUtils/src/GeoUtils.min.js

@FloraCat526
Copy link
Contributor

FloraCat526 commented Oct 31, 2022

鼠标绘制与面积计算可以使用新的鼠标绘制库BMap-Draw,https://www.npmjs.com/package/bmap-draw

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