Remove Overlay Layers on a Web Map
To remove an overlay layer on a web map, use the
When called without an argument,
wmremove deletes the most recently
added overlay layer. You can also remove a particular overlay by specifying the handle
of the line or marker overlay. The following example illustrates this capability.
Load latitude and longitude data. This command loads two variables into the workspace:
Add a line overlay of the coastline data and set the overlay to a variable using the
wmlinefunction. There is no current web map, so
h = wmline(coastlat,coastlon,'Width',3,'FeatureName','coastline');
Add a marker overlay and set it to a variable using the
wmmarkerfunction. The marker highlights the location of the city of Caracas. Note that the overlays are listed in the Layer Manager as Line Overlay 1 and Marker Overlay 2.
h2 = wmmarker(10.5000,-66.8992,'FeatureName','Caracas');
Remove one of the overlays by using the
wmremovefunction. When called without an argument,
wmremovedeletes the most recent overlay. In this case,
wmremoveremoves the marker overlay. The
wmremovefunction also removes the marker entry in the Layer Manager.
Remove a particular overlay by specifying it when you call
wmremove. For example, remove the line overlay.