Basic Workflow for Creating WMS Maps

Workflow Summary

  1. Search the WMS Database for layers and servers that are of interest to you.

  2. Refine your search to include only servers or layers with specified field values.

  3. Update your layer to synchronize your selected layer with the server.

  4. Modify your WMS request to set properties like geographic limits, image dimensions, or background color of the map.

  5. Retrieve your map as a raster image from the server.

  6. Display the map.

Create a Map of Elevation in Europe

Follow the example to learn the basic steps in creating a WMS map.

  1. Search the WMS Database. Mapping Toolbox™ software simplifies the process of WMS map creation by using a stored database of WMS servers. You can search the database for layers and servers that are of interest to you. WMS servers store map data in units called layers. For this example, search for layers that contain the word 'elevation'.

    elevation = wmsfind('elevation');

    wmsfind returns an array of hundreds of WMSLayer objects.

  2. Refine your search. Refine your search to include only layers that contain the exact name, 'Foundation.GTOPO30' in the LayerName field. (GTOPO30 is a digital elevation model developed by the United States Geological Survey (USGS).) Then, refine the results of this search further by searching the serverurl field for ''.

    gtopolayer = refine(elevation,'Foundation.GTOPO30', ...
    gtopolayer = refine(gtopolayer,'', ...
  3. Update your layer. Contact the web server identified in the database search to get the most up-to-date information. The wmsupdate function accomplishes two tasks:

    • Updates your WMSLayer object to include the most recent data

    • Fills in its Details, CoordRefSysCodes, and Abstract fields

    Setup a map axes with geographic limits appropriate for Europe.

    worldmap europe;
  4. Modify your WMS request. Retrieve the map axes map structure (mstruct), which contains the settings for all the current map axes properties. You can use this struct to modify your WMS request. For example, you can set geographic limits, image dimensions, background color, and other properties of the map. In this simple example, define the color you want to use a the map background color. Choose red, green, and blue levels to define an ocean color.

    mstruct = gcm;
    oceanColor = [0 170 255];
  5. Retrieve your map. Use the WMSLayer object gtopolayer as input for wmsread. Set the wmsread longitude and latitude limit parameters to the current map axes limits and set the BackgroundColor parameter to oceanColor.

    [elevationImage, R] = wmsread(gtopolayer,'Latlim', ...
       mstruct.maplatlimit,'Lonlim',mstruct.maplonlimit, ...

    The wmsread function returns a map called elevationImage and a raster reference object R, which ties the map to a specific location on Earth.

  6. Display Vector Data as Points and Lines.


See Also

| |

Related Topics