Code covered by the BSD License  

Highlights from
WORLDDATAMAP

image thumbnail
from WORLDDATAMAP by Kelly Luetkemeyer
Map a region using data from a shapefile or data grid.

WORLDDATAMAP Reference

WORLDDATAMAP Reference

WORLDDATAMAP wraps the Mapping Toolbox function WORLDMAP and adds data to the map. The data may consist of vector data from shapefiles or surface data from a regular data grid.

Contents

Motivation and Design Goal

The design goal of WORLDDATAMAP is to create a function which wraps the Mapping Toolbox version 2.1 of WORLDMAP but provide the same functionality of WORLDMAP in versions prior to 2.1 (MATLAB versions R14SP1 and earlier). The goal of the interface design is for users to only add DATA to the function call WORLDMAP to view a similar figure as in prior versions of the function WORLDMAP.

Vector Datasets

WORLDDATAMAP uses the following sample data sets, which are provided with the demos in Version 2.1 of the Mapping Toolbox:

  • landareas.shp
  • worldcities.shp
  • worldrivers.shp
  • worldlakes.shp

The landareas.shp file is the default vector dataset.

The worldcities.shp file displays the names and locations of the major metropolitan cities, if requested.

The worldrivers.shp and worldlakes.shp files display the the world's rivers and lakes, if requested.

Feature Options

Several new options are available for WORLDDATAMAP that do not exist in WORLDMAP. These include the following new FeatureType options:

  • rivers - display blue worldrivers from worldrivers.shp.
  • lakes - display blue worldlakes from worldlakes.shp.
  • cities - display cities from worldcities.shp.
  • labels - display labels if LabelLon and LabelLat exist in the shapefile.
  • all - display cities, rivers, lakes and labels.

In addition to the new FeatureType options, a FILENAME option has been added to provide data from a different shapefile. For example:

  • worlddatamap('filename.shp', 'world') % Reads from file, filename.shp

The SHAPEFILENAME must end in '.shp', or '.dbf'. This option provides the flexibility to use a different shapefile other than landareas.shp. The coordinate values of the shapefile must be in degrees.

The default region attribute field name is 'Name'. The field names are queried with SHAPEINFO. The default field name may be changed using the cell syntax, {FILENAME, REGIONATTRIBUTE}. For example:

  • worlddatamap({'filename,shp','Region'},'my_region')

This example will extract and display 'my_region' from the attribute field, 'Region' in the shapefile, 'filename.shp'.

Version Checking

WORLDDATAMAP verifies that Mapping Toolbox version 2.1 or higher is installed and that the Mapping Toolbox datasets exist.

Contact us at files@mathworks.com