Display geographic data from display structure


h = displaym(displaystruct)


displaym(displaystruct) projects the data contained in the input displaystruct, a Version 1 Mapping Toolbox™ display structure, in the current axes. The current axes must be a map axes with a valid map definition. See the remarks about Version 1 Display Structures below for details on the contents of display structures.

displaym(displaystruct,str) displays the vector data elements of displaystruct whose 'tag' fields contains strings beginning with the string str. Vector data elements are those whose 'type' field is either 'line' or 'patch'. The string match is case-insensitive.

displaym(displaystruct,strings) displays the vector data elements of displaystruct whose 'tag' field matches begins with one of the elements (or rows) of strings. strings is a cell array of strings (or a 2-D character array). In the case of character array, trailing blanks are stripped from each row before matching.

displaym(displaystruct,strings,searchmethod) controls the method used to match the values of the tag field in displaystruct, as follows:

  • 'strmatch' — Search for matches at the beginning of the tag

  • 'findstr' — Search within the tag

  • 'exact' — Search for exact matches

Note that when searchmethod is specified the search is case-sensitive.

h = displaym(displaystruct) returns handles to the graphic objects created by displaym.

    Note:   The type of display structure accepted by displaym is not the same as a geographic data structure (geostructs and mapstructs). introduced in Mapping Toolbox Version 2. Use geoshow or mapshow instead of displaym to display geostructs or mapstructs—created using shaperead and gshhs, for example. For more information, see Mapping Toolbox Geographic Data Structures.

More About

collapse all


The following section documents the contents of display structures.

Version 1 Display Structures

A display structure is a MATLAB® structure array with a specific set of fields:

  • A tag field names an individual feature or object

  • A type field specifies a MATLAB graphics object type ('line', 'patch', 'surface', 'text', or 'light') or has the value 'regular', specifying a regular data grid

  • lat and long fields contain coordinate vectors of latitudes and longitudes, respectively

  • An altitude field contains a vector of vertical coordinate values

  • A string property contains text to be displayed if type is 'text'

  • MATLAB graphics properties are specified explicitly, on a per-feature basis, in an otherproperty field

The choice of options for the type field reveals that a display structure can contain

  • Vector geodata (type is 'line' or 'patch')

  • Raster geodata (type is 'surface' or 'regular')

  • Graphic objects (type is 'text' or 'light')

The following table indicates which fields are used in the six types of display structures:

Field Name

Type 'light'

Type 'line'

Type 'patch'

Type 'regular'

Type 'surface'

Type 'text'


















Some fields can contain empty entries, but each indicated field must exist for the objects in the struct array to be displayed correctly. For instance, the altitude field can be an empty matrix and the otherproperty field can be an empty cell array.

The type field must be one of the specified map object types: 'line', 'patch', 'regular', 'surface', 'text', or 'light'.

The tag field must be a string different from the type field usually containing the name or kind of map object. Its contents must not be equal to the name of the object type (i.e., line, surface, text, etc.).

The lat, long, and altitude fields can be scalar values, vectors, or matrices, as appropriate for the map object type.

The map field is a data grid. If map is a regular data grid, maplegend is its corresponding referencing vector, and meshgrat is a two-element vector specifying the graticule mesh size. If map is a geolocated data grid, lat and long are the matrices of latitude and longitude coordinates.

The otherproperty field is a cell array containing any additional display properties appropriate for the map object. Cell array entries can be a line specification string, such as 'r+', or property name/property value pairs, such as 'color','red'. If the otherproperty field is left as an empty cell array, default colors are used in the display of lines and patches based on the tag field.

    Note:   In some cases you can use the geoshow function as a direct alternative to displaym. It accepts display structures of type line and patch.

Was this topic helpful?