Remove Overlay Layers on a Web Map
To remove an overlay layer on a web map, use the wmremove
function.
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:
coastlat
andcoastlon
.load coastlines
Add a line overlay of the coastline data and set the overlay to a variable using the
wmline
function. There is no current web map, sowmline
creates one.h = wmline(coastlat,coastlon,'Width',3,'FeatureName','coastline');
Add a marker overlay and set it to a variable using the
wmmarker
function. 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
wmremove
function. When called without an argument,wmremove
deletes the most recent overlay. In this case,wmremove
removes the marker overlay. Thewmremove
function also removes the marker entry in the Layer Manager.wmremove
Remove a particular overlay by specifying it when you call
wmremove
. For example, remove the line overlay.wmremove(h)
See Also
webmap
| wmline
| wmpolygon
| wmmarker
| wmremove