| Mapping Toolbox | ![]() |
Define specially formatted structure containing data for map objects
Description
Data for map objects can be stored in a specially formatted structure called a geographic data structure, which allows for easy display, manipulation, and extraction of map data. The Mapping Toolbox provides the displaym, extractm, and mlayers tools specifically designed to be used with such structures.
A geographic data structure can be defined for six different types of map objects: lines, patches, regular surfaces, general surfaces, text, and light objects. A specific set of fields is required for each different type of map object. Each of these required fields must exist for each element in the structure. However, fields that are not essential for displaying the object can be left empty. For example, the otherproperty field must exist, but can be an empty cell array. Listed below are the six types of map objects along with their required fields.
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.
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 matrix map. If map is a regular matrix map, maplegend is its corresponding matrix map legend, and meshgrat is a two-element vector specifying the graticule mesh size. If map is a general matrix map, 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-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.
Examples
The layermtx workspace contains five different geographic data structures:
load layermtx whos Name Size Bytes Class cities 1x10 15956 struct array citymarker 1x10 7048 struct array lights 1x2 1798 struct array matrixmaps 1x2 141414 struct array topostruct 1x1 519342 struct array
The citymarker structure contains ten elements, each consisting of the required fields for a line object:
The first element contains data for a Cape Town city marker. Note that the altitude field can be left empty:
citymarker(1) ans = lat: -34 long: 18.30000000000000 type: 'line' tag: 'Cape Town' altitude: [] otherproperty: {1x1 cell}
The otherproperty field indicates that the city marker for Cape Town will be a blue asterisk:
See Also
displaym |
Project data in a geographic data structure |
extractm |
Extract vector data from a geographic data structure |
mlayers |
GUI for manipulating map layers |
| geod2rec | geoid vector | ![]() |