extractm - Coordinate data from line or patch display structure

Syntax

[lat,lon] = extractm(display_struct,object_str)
[lat,lon] = extractm(display_struct,object_strings)
[lat,lon] = extractm(display_struct,object_strings,searchmethod)
[lat,lon] = extractm(display_struct)
[lat,lon,indx] = extractm(...)
mat = extractm(...)

Description

[lat,lon] = extractm(display_struct,object_str) extracts latitude and longitude coordinates from those elements of display_struct having 'tag' fields that begin with the string specified by object_str. display_struct is a Mapping Toolbox display structure in which the 'type' field has a value of either 'line' or 'patch'. The output lat and lon vectors include NaNs to separate the individual map features. The comparison of 'tag' values is not case-sensitive.

[lat,lon] = extractm(display_struct,object_strings), where object_strings is a character array or a cell array of strings, selects features with 'tag' fields matching any of several different strings. Character array objects will have trailing spaces stripped before matching.

[lat,lon] = extractm(display_struct,object_strings,searchmethod) controls the method used to match the values of the 'tag' field in display_struct. searchmethod can be one of three strings:

'strmatch'Search for matches at the beginning of the tag (similar to the strmatch function)
'findstr'Search within the tag (similar to the findstr function)
'exact'Search for exact matches. Note that when searchmethod is specified the search is case-sensitive.

[lat,lon] = extractm(display_struct) extracts all vector data from the input map structure.

[lat,lon,indx] = extractm(...) also returns the vector indx identifying which elements of display_struct met the selection criteria.

mat = extractm(...) returns the vector data in a single matrix, where mat = [lat lon].

Example

Extract the District of Columbia from the low-resolution U.S. vector data:

   load greatlakes
   [lat, lon] = extractm(greatlakes, 'Erie');
   axesm mercator
   geoshow(lat,lon, 'DisplayType','polygon', 'FaceColor','blue')

Remarks

A Version 1 display structure is a MATLAB structure that can contain line, patch, text, regular data grid, geolocated data grid, and certain other objects and fixed attributes. In Mapping Toolbox Version 2, a new data structure for vector geodata was introduced (called a mapstruct or a geostruct, depending on whether coordinates it contains are projected or unprojected). Geostructs and mapstructs have few required fields and can include any number of user-defined fields, giving them much greater flexibility to represent vector geodata. For information about the contents and format of display structures, see Version 1 Display Structures in the reference page for displaym. For information about converting display structures to geographic data structures, see the reference page for updategeostruct, which performs such conversions.

See Also

displaym, extractfield, geoshow, mapshow, updategeostruct, mlayers

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS