Main Content

getMap

Get raster map from server

Description

example

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

Examples

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.

figure
worldmap world
geoshow(A,R)
setm(gca,'MLabelParallel',-90,'MLabelLocation',90)
title(layer.LayerTitle)

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.

Tips

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

Introduced before R2006a