geoshape
Geographic shape vector
Description
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.
Attributes that vary spatially 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.
To create a geographic point, line, or polygon shape for use with a geospatial table,
create a geopointshape
,
geolineshape
,
or geopolyshape
object instead.
Creation
Syntax
Description
s = geoshape()
constructs an empty geoshape vector,
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.
s = geoshape(
sets the latitude
,longitude
)Latitude
and Longitude
properties of geoshape vector s
.
s = geoshape(
sets the latitude
,longitude
,Name,Value
)Latitude
and Longitude
properties, then adds dynamic properties to the geoshape vector using
Name,Value
argument pairs. You can specify several
name-value pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
s = geoshape(
constructs
a structArray
)geoshape
vector from the fields of the structure array,
structArray
.
If
structArray
contains the fieldLat
, and does not contain the fieldLatitude
, then theLatitude
property values are set equal to theLat
field values. Similar behavior occurs whenstructArray
contains the fieldLon
and does not contain the fieldLongitude
.If
structArray
contains bothLat
andLatitude
fields, then theLatitude
property values are set equal to theLatitude
field values. Also, aLat
dynamic property is created and its values are set equal to theLat
field values. Similar behavior occurs forLon
andLongitude
fields when both are present instructArray
.Other
structArray
fields are assigned tos
and become dynamic properties. Field values instructArray
that are not numeric values, string scalars, string arrays, character vectors, logical, or cell arrays of numeric values, logical, or character vectors are ignored. You can specify vectors within cell arrays as either row or column vectors.
s = geoshape(
sets the latitude
,longitude
,structArray
)Latitude
and Longitude
properties, and sets dynamic properties from the field values of
structArray
.
If
structArray
contains the fieldsLat
,Latitude
,Lon
orLongitude
, then those field values are ignored since thelatitude
andlongitude
input vectors set theLatitude
andLongitude
property values.
Properties
Object Functions
append | Append features to geographic or planar vector |
cat | Concatenate geographic or planar vector |
disp | Display geographic or planar vector |
fieldnames | Return dynamic property names of geographic or planar vector |
isempty | Determine if geographic or planar vector is empty |
isfield | Determine if dynamic property exists in geographic or planar vector |
isprop | Determine if property exists in geographic or planar vector |
length | Return number of elements in geographic or planar vector |
properties | Return property names of geographic or planar vector |
rmfield | Remove dynamic property from geographic or planar vector |
rmprop | Remove property from geographic or planar vector |
size | Return size of geographic or planar vector |
struct | Convert geographic or planar vector to scalar structure |
vertcat | Vertically concatenate geographic or planar vectors |
Examples
More About
Tips
The
geoshape
function separates features usingNaN
values. If you display a feature by using a scalar to index into the geoshape vector, such ass(1)
, thenNaN
values that separate the features do not display.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
orLongitude
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
orLongitude
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
Version History
Introduced in R2012a