webglearth / webglearth2

[UNMAINTAINED] WebGL Earth 2 - the source code of the project
Apache License 2.0
884 stars 212 forks source link

How to remove a polygon. #102

Open usmanzaheer1995 opened 6 years ago

usmanzaheer1995 commented 6 years ago

How can i remove a polygon from map? polygon.removeFrom(map) does not work as it does for removing a marker.

jflee1982 commented 6 years ago

I also need to solve the problem~! webgl earth has little api interface!

rexxmagnus commented 1 year ago

Very old, I know, but construct the polygon with a reference, then use the variable holding the polygon and call

var polygon = WE.polygon([.... coords ...], { }).addTo(earth);

polygon.destroy();
polygon = null;

You can then re-reference the polygon variable to create a new one.