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.

  1. Load latitude and longitude data. This command loads two variables into the workspace: coastlat and coastlon.

    load coastlines
  2. Use the latitude and longitude data to define a line overlay. wmline draws the line on the current web map or, if none exists, it creates a new web map. Get a handle to the overlay.

    h = wmline(coastlat, coastlon, 'Width', 3, 'FeatureName', 'coastline')

  3. Add another overlay to the web map, using the wmmarker function. The marker highlights the location of the city of Caracas. Get a handle to the overlay.

    h2 = wmmarker(10.5000,-66.8992,'FeatureName','Caracas')

  4. Remove one of the overlays, using wmremove. When called without an argument, wmremove deletes the most recent overlay, which would be the marker overlay. wmremove also removes the entry in the Layer Manager for the overlay layer.


  5. Remove a particular overlay, using wmremove, specifying a handle to an overlay. This example removes the line overlay.


See Also

| | | |

Related Topics