Modify Your Map Request

Set Map Request Geographic Limits and Time

A WMSMapRequest object contains properties to modify the geographic extent and time of the requested map. This example demonstrates how to modify your map request to map sea surface temperature for the ocean surrounding the southern tip of Africa. For a complete list of properties, see WMSMapRequest.

  1. Search the WMS Database for all layers on NASA's Earth Observations (NEO) WMS server.

    neowms = wmsfind('neowms', 'SearchField', 'serverurl');
  2. Refine your search to include only layers with 'sea surface temperature' in the layer title or layer name fields of the WMS database.

    sst = neowms.refine('sea surface temperature');
    
  3. Refine your search to include only layers with monthly values from the MODIS sensor on the Aqua satellite.

    sst = sst.refine('month*modis');
    
  4. Construct a WebMapServer object from the server URL stored in the ServerURL property of the WMSLayer object sst.

    server = WebMapServer(sst(1).ServerURL);
    
  5. Construct a WebMapRequest object from a WMSLayer array and a WebMapServer object.

    mapRequest = WMSMapRequest(sst, server);
    
  6. Use the Latlim and Lonlim properties of WMSMapRequest to set the latitude and longitude limits.

    mapRequest.Latlim = [-45 -25];
    mapRequest.Lonlim = [15 35];
    
  7. Set the time request to March 1, 2009.

    mapRequest.Time = '2009-03-01';
    
  8. Send your request to the server with the WebMapServer.getMap method. Pass in a WMSMapRequest.RequestURL.

    sstImage = server.getMap(mapRequest.RequestURL);
    
  9. Set up empty map axes with the specified geographic limits.

    figure
    worldmap(mapRequest.Latlim, mapRequest.Lonlim);
    setm(gca, 'mlabelparallel', -45)
  10. Project and display an image georeferenced to latitude and longitude. Use the raster reference object provided by the RasterReference property of the WMSMapRequest object.

    geoshow(sstImage, mapRequest.RasterReference);
    title({'South Africa', sst.LayerTitle}, ...
        'FontWeight', 'bold', 'Interpreter', 'none')

Edit Web Map Request URL Manually

You can modify a map request URL manually.

  1. Obtain the map request URL.

    nasa = wmsfind('nasa', 'SearchField', 'serverurl');
    layer = nasa.refine('bluemarbleng', 'SearchField', 'layername', ...
       'MatchType', 'exact');
    layer = layer(1);
    mapRequest = WMSMapRequest(layer);
    
  2. Set the map request URL to a variable.

    mapURL = mapRequest.RequestURL;
  3. Modify the bounding box to include the southern hemisphere. To do this, create a new variable called modifiedURL by copying and pasting the contents of mapURL. Then, change the bounding box section of the URL to:

    &BBOX=-180.0,-90.0,180.0,0.0

    Enter the URL as one continuous character vector.

  4. Display the modified map.

    [A, R] = wmsread(modifiedURL);
    figure
    axesm globe
    axis off
    geoshow(A, R)
    title('Blue Marble: Southern Hemisphere Edition')
    

    The image is courtesy of NASA/JPL-Caltech.

See Also

| |

Related Topics