plotPosition

Display current position in geoplayer figure

Description

example

plotPosition(player,lat,lon) plots a point with latitude and longitude coordinates in a geoplayer figure.

plotPosition(player,lat,lon,Name,Value) uses Name,Value pair arguments to modify the visual style of the plotted points.

For example, plotPosition(player,45,0,'Color','w','Marker','*') plots a point in the geoplayer figure as a white star.

Examples

collapse all

Load a sequence of latitude and longitude coordinates.

data = load('geoRoute.mat');

Create a geographic player and set the zoom level to 12. Compared to the default zoom level, this zoom level zooms the map out by a factor of 8.

player = geoplayer(data.latitude(1),data.longitude(1),12);

Display the full route.

plotRoute(player,data.latitude,data.longitude);

Display the coordinates in a sequence. The circle marker indicates the current position.

for i = 1:length(data.latitude)
    plotPosition(player,data.latitude(i),data.longitude(i));
    pause(0.05)
end

Input Arguments

collapse all

Streaming geographic player, specified as a geoplayer object.

Latitude coordinate of the point to display in the geographic player, specified as a real scalar in the range [–90, 90].

Data Types: single | double

Longitude coordinate of the point to display in the geographic player, specified as a real scalar in the range [–180, 180].

Data Types: single | double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Color','k'

Text description of the point, specified as the comma-separated pair consisting of 'Label' and a character vector or string scalar.

Example: 'Label','07:45:00AM'

Marker color, specified as the comma-separated pair consisting of 'Color' and a color name, short color name, or RGB triplet. By default, the marker color is selected automatically.

For a custom color, specify an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7]. Alternatively, you can specify some common colors by name. This table lists the named color options and the equivalent RGB triplet values.

Color NameColor Short NameRGB TripletAppearance
'red''r'[1 0 0]

'green''g'[0 1 0]

'blue''b'[0 0 1]

'cyan' 'c' [0 1 1]

'magenta''m'[1 0 1]

'yellow''y'[1 1 0]

'black''k'[0 0 0]

'white''w'[1 1 1]

Example: 'Color',[1 0 1]

Example: 'Color','m'

Example: 'Color','magenta'

Marker symbol, specified as the comma-separated pair consisting of 'Marker' and one of the markers in this table.

ValueDescription
'o'Circle
'+'Plus sign
'*'Asterisk
'.'Point
'x'Cross
'square' or 's'Square
'diamond' or 'd'Diamond
'^'Upward-pointing triangle
'v'Downward-pointing triangle
'>'Right-pointing triangle
'<'Left-pointing triangle
'pentagram' or 'p'Five-pointed star (pentagram)
'hexagram' or 'h'Six-pointed star (hexagram)

Approximate diameter of marker in points, specified as the comma-separated pair consisting of 'MarkerSize' and a positive real scalar. 1 point = 1/72 inch. A marker size larger than 6 can reduce the rendering performance.

Introduced in R2018a