Main Content

webmap

Description

webmap opens a new web map, with its center at the latitude, longitude point [0 0]. By default, webmap sets the base layer to World Street Map at the maximum spatial extent available. After the web map opens, you can select a different base layer using the Layer Manager available on the right side of the web map. Named base layers are tiled at discrete zoom resolutions.

Note

The webmap function requires an Internet connection. MathWorks® cannot guarantee the stability and accuracy of web maps, as the servers are on the Internet and are independent from MathWorks. Occasionally, maps may be slow to display, display partially, or fail to display, because web map servers can become unavailable for short periods of time.

example

webmap(baseLayer) opens a new web map with baseLayer as the default base layer. See baseLayer for a list of the available maps.

example

webmap(wmsLayer) Opens a new web map with wmsLayer as the default base layer. wmsLayer is a WMSLayer array. The LayerTitle property of each wmsLayer is set as an item in the Layer Manager.

webmap displays WMS layers in the "Web Mercator" map coordinate reference system, if that projection is available for all layers in the array. Otherwise, webmap displays the layers in the EPSG:4326 geographic coordinate reference system. When using EPSG:4326, webmap does not include the default base layers in the Layer Manager since they are in a different coordinate reference system. These projections include a geographic quadrangle bounded north/south by parallels and east/west by meridians. Parallels map to horizontal lines. Meridians map to vertical lines.

webmap(customBasemap) opens a new web map using the custom basemap specified by the addCustomBasemap function. customBasemap is a string scalar or character vector specifying the display name of the custom basemap, if provided, or the basemap name.

webmap(___,'WrapAround',tf), where tf is specified as the logical value false or 0, opens a new web map with the display clipped to the west at -180 degrees and to the east at +180 degrees. The default for tf is true or 1, which opens a map that supports continuous pan and zoom across the 180-degree meridian. The webmap function constrains zoom to show less than 180 degrees of longitude at a time.

wm = webmap(___) returns a handle to a web map, wm.

webmap(wm) makes the web map specified by wm the current web map.

Examples

collapse all

Open a web map centered at [0 0].

webmap

Web map displaying a global region

To view the list of available base layers (basemaps), open the Layer Manager by clicking the expander arrow webmap_expanderarrow.png on the right side of the map.

Layer Manager with options for base layers and overlay layers

Open a web map specifying the base layer and show the full extent of the world.

webmap('Light Gray Canvas Map','WrapAround',false)

Search the WMS Database for WMS layers containing the string "bluemarble". Refine the search to include only layers from the NASA Earth Observations (NEO) WMS server. Extract the first layer.

baselayer = wmsfind("bluemarble");
baselayer = refine(baselayer,"neo.gsfc.nasa.gov","SearchFields","serverurl");
baselayer = baselayer(1);

Display a web map with the Blue Marble WMS layer as the base layer.

webmap(baselayer)

World map with satellite imagery of the world

Add a basemap from OpenTopoMap as a custom base layer. Specify values for these arguments:

  • A name that identifies the custom basemap.

  • The URL of the map tiles. For load balancing, this provider has three servers you can use (a, b, and c).

  • An attribution that gives credit to the provider of the map tiles. When you plot data, this attribution appears at the bottom of the map. Map tile providers can define specific requirements for the attribution.

  • The name that appears in the Layer Manager tab of the web map.

basemapName = "opentopomap";
url = "a.tile.opentopomap.org/${z}/${x}/${y}.png";
attribution = "©OpenStreetMap contributors";
displayName = "Open Topo Map";
addCustomBasemap(basemapName,url,"Attribution",attribution, ...
      "DisplayName",displayName)

Create a web map that uses the custom basemap.

webmap opentopomap

A web map displaying the OpenTopoMap basemap

Input Arguments

collapse all

Map displayed in the web map, specified as a string scalar or character vector, listed in the following table. If specified as string scalar or character vector, the value is case insensitive and spaces are optional.

NameDescription
'World Street Map'

Worldwide street map provided by Esri®. For information about the Esri ArcGIS Online layers, visit https://www.arcgis.com/home/gallery.html#c=esri&f=basemaps&t=maps.

'Open Street Map'

Street map from openstreetmap.org. For more information, visit https://www.openstreetmap.org.

'World Imagery'

Worldwide imagery provided by Esri.

'World Topographic Map'

Topographic map for the world from Esri.

'World Shaded Relief'Surface elevation as shaded relief provided by Esri
'World Physical Map'Natural Earth map of the world provided by Esri
'World Terrain Base'Shaded relief and bathymetry provided by Esri
'USGS Imagery'Composite of Blue Marble, NAIP, and Landsat provided by the USGS.
'USGS Topographic Imagery'Topographic map with imagery provided by the USGS.
'USGS Shaded Topographic Map'Composite of contours, shaded relief, and vector layers provided by the USGS.
'National Geographic Map'General reference map provided by Esri
'Ocean Basemap'Bathymetry, marine features, depth in meter provided by Esri
'World Navigation Charts'Topographic data with nautical information provided by Esri
'Light Gray Canvas Map'Neutral background map with minimal colors provided by Esri

Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks.

Data Types: char | string

Web map service layer, specified as a WMSLayer array.

Web maps do not support layers from wms.mathworks.com.

Name of custom basemap, specified as a string scalar or character vector. The value is case-insensitive and spaces are optional. Create a custom basemap by using the addCustomBasemap function.

Web maps do not support custom basemaps created from MBTiles files, images, or data grids. Web maps also do not support custom vector basemaps hosted by Esri.

Data Types: char | string

Web map, specified as a web map handle, returned by the webmap function.

Output Arguments

collapse all

Web map, returned as a web map handle.

Limitations

In MATLAB® Online™, if you refresh the URL, then the window containing the web map closes. In addition, if you returned a handle to the web map, then it is deleted.

More About

collapse all

Web Map

An interactive map accessed through a web page. In a web map, you can select different map layers to view and navigate around the map using interactive tools, such as zooming. The web map is a window that displays map base layers obtained from web servers on the Internet. You can also display overlay layers that contain custom point and line vector data.

Tips

Particular maps may not support every available zoom level. If your map displays as white, try another zoom level. The map you are displaying might not support the zoom level you have currently selected. You can also select another base layer, which might support the specified zoom level.

Version History

Introduced in R2013b

expand all