Main Content


Get raster map from server



A = getMap(server,mapRequestURL) dynamically renders and retrieves a color or grayscale, geographically referenced, raster map from the Web map services server, server, and stores it in A. Parameters in the URL, mapRequestURL, define the map. The getMap function also updates the RequestURL property of the server with mapRequestURL.

Most of the time, you can read a WMS map using wmsread function instead of the getMap function. Use the getMap function when:

  • Working with non-EPSG:4326 reference systems

  • Creating an animation of a specific geographic area over time

  • Retrieving multiple layers from a WMS server


collapse all

Read a map from the NASA Earth Observations WMS server.

Search the WMS Database for the Blue Marble global mosaic layer from the NASA Earth Observations WMS server.

neowms = wmsfind('neowms','SearchField','serverurl');
layer = refine(neowms,'bluemarbleng','MatchType','exact');

Read the map from the server.

server = WebMapServer(layer.ServerURL);
mapRequest = WMSMapRequest(layer,server);
A = getMap(server,mapRequest.RequestURL);
R = mapRequest.RasterReference;

Display the map.

worldmap world

Input Arguments

collapse all

Web map server, specified as a WebMapServer object.

URL, specified as a character vector. Parameters in the URL define the map.

You can get a URL from:

  • The output of wmsread

  • The RequestURL property of a WMSMapRequest object

  • An Internet search

Output Arguments

collapse all

Rendered map, returned as a color or grayscale image.


getMap accesses the Internet to retrieve the map. Periodically, the WMS server is unavailable. Retrieving the map can take several minutes.

Introduced before R2006a