I have tried to add a click handler to the map, but am not sure how to tell when the polygon has finished drawing. Is there a simple function to get the polygon coordinates on draw end ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can probably adapt https://stackoverflow.com/a/24835176/228885 for your purposes. As mentioned in another answer feature.once('change', ...)
might be another way to go. I expect in that case you would pick the last element from the feature passed to the handler. Then you would extract the coordinates out of it and off you go.
TLDR; Listen add
or change
of features, extract coordinate.