Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Geographic shape vector

A geoshape vector is an object that represents geographic vector
features with either point, line, or polygon topology. The features
consist of latitude and longitude coordinates and associated attributes.
If these attributes vary spatially, they are termed Vertex properties.
These elements of the geoshape vector are coupled such that the length
of the latitude and longitude coordinate property values are always
equal in length to any additional dynamic Vertex properties. Attributes
that only pertain to the overall feature (point, line, polygon) are
termed Feature properties. Feature properties are not linked to the
autosizing mechanism of the Vertex properties. Both property types
can be added to a geoshape vector during construction or by using
standard dot (`.`

) notation after construction.

constructs
an empty geoshape vector, `s`

= geoshape()`s`

, with these default
property settings.

s = 0x1 geoshape vector with properties: Collection properties: Geometry: 'line' Metadata: [1x1 struct] Vertex properties: Latitude: [] Longitude: []

`s`

is always a column vector. For an additional
example, see Construct a Default Geoshape Vector, Then Add Properties.

constructs
a geoshape vector and sets the `s`

= geoshape(`lat`

,`lon`

)`Latitude`

and `Longitude`

property
values equal to `lat`

and `lon`

.
For an example, see Construct a geoshape Vector Specifying Latitude and Longitude Values.

constructs
a geoshape vector, then adds dynamic properties to the geoshape vector
using `s`

= geoshape(`lat`

,`lon`

,`Name,Value`

)`Name,Value`

argument pairs. You can specify
several name-value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`

.
For an example, see Construct a Geoshape Vector with Dynamic Properties.

constructs
a `s`

= geoshape(`structArray`

)`geoshape`

vector from the fields of the structure
array, `structArray`

. For an example, see the
first method in Construct a Geoshape Vector from a Structure Array.

If

`structArray`

contains the field`Lat`

, and does not contain the field`Latitude`

, then the`Latitude`

property values are set equal to the`Lat`

field values. Similar behavior occurs when`structArray`

contains the field`Lon`

and does not contain the field`Longitude`

.If

`structArray`

contains both`Lat`

and`Latitude`

fields, then the`Latitude`

property values are set equal to the`Latitude`

field values. Also, a`Lat`

dynamic property is created and its values are set equal to the`Lat`

field values. Similar behavior occurs for`Lon`

and`Longitude`

fields when both are present in`structArray`

.Other

`structArray`

fields are assigned to`s`

and become dynamic properties. Field values in`structArray`

that are not numeric values, character vectors, logical, or cell arrays of numeric values, logical, or character vectors are ignored.

constructs
a new `s`

= geoshape(`lat`

,`lon`

,`structArray`

)`geoshape`

vector, sets the `Latitude`

and `Longitude`

properties
equal to the numeric vectors `lat`

and `lon`

,
and sets dynamic properties from the field values of `structArray`

.
For an example, see Construct a Geoshape Vector Using Cell Arrays.

If

`structArray`

contains the fields`Lat`

,`Latitude`

,`Lon`

or`Longitude`

, then those field values are ignored since the`lat`

and`lon`

input vectors set the`Latitude`

and`Longitude`

property values.

Construct a geoshape vector with dynamic properties using comma-separated
pairs of `Name,Value`

arguments. `Name`

is
the name of the dynamic property and `Value`

is the
corresponding value. `Name`

must appear inside single
quotes (`' '`

). You can specify
several dynamic properties as `Name1,Value1,...,NameN,ValueN`

.

If `Value`

is specified as a numeric, logical,
character vector, or cell array of character vectors, then the property
is designated a Feature property. If `Value`

is specified
as a cell array of numeric, logical, or cell array of character vectors,
then the property is designated a Vertex property. If `Value`

is
any other type, then the field is ignored and no dynamic property `Name`

is
added to the geoshape vector.

append | Append features to geoshape vector |

cat | Concatenate geoshape vectors |

disp | Display geoshape vector |

fieldnames | Return dynamic property names of geoshape vector |

isempty | Return true if geoshape vector is empty |

isfield | Return true if dynamic property exists |

isprop | Return true if property exists |

length | Return number of elements in geoshape vector |

properties | Return property names of geoshape vector |

rmfield | Remove dynamic property from geoshape vector |

rmprop | Remove properties from geoshape vector |

size | Return size of geoshape vector |

struct | Convert geoshape vector to scalar structure |

vertcat | Vertically concatenate geoshape vectors |

Value. To learn how value classes affect
copy operations, see Copying Objects (MATLAB) in
the MATLAB^{®} documentation.

If

`Latitude`

,`Longitude`

, or a dynamic property is set with more values than features in the geoshape vector, then all other properties expand in size using 0 for numeric values and an empty character vector (`''`

) for cell values.If a dynamic property is set with fewer values than the number of features, then this dynamic property expands to match the size of the other properties, by inserting a 0 if the value is numeric or an empty character vector (

`''`

), if the value is a cell array.If the

`Latitude`

or`Longitude`

property of the geoshape vector is set with fewer values than contained in the object, then all other properties shrink in size.If either

`Latitude`

or`Longitude`

are set to [ ], then both coordinate properties are set to [ ] and all dynamic properties are removed.If a dynamic property is set to [ ], then it is removed from the object.

The geoshape vector can be indexed like any MATLAB vector. You can access any element of the vector to obtain a specific feature. The following examples demonstrate this behavior:

Use Indexing to Append a Single Point and a Shape to a Geoshape Vector

Was this topic helpful?