Main Content

情节定位

显示当前位置geoplayer数字

Description

例子

情节定位(player,,,,lat,,,,lon绘制由纬度和经度坐标指定的点((lat,,,,lon),,,,in thegeoplayer数字,,,,specified byplayer。To plot multiple routes simultaneously, specify a unique identifier for each route using theTrackID范围。

情节定位(player,,,,lat,,,,lon,,,,姓名,,,,Valueuses姓名,,,,Valuepair arguments to modify aspects of the plotted points.

For example,绘制位置(播放器,45,0,'颜色','w','marker','*')plots a point in thegeoplayer数字as a white star.

Examples

collapse all

加载一系列纬度和经度坐标。

数据=负载('georoute.mat');

创建一个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.

为了i = 1:length(data.latitude) plotPosition(player,data.latitude(i),data.longitude(i)); pause(0.05)结尾

Plot multiple routes simultaneously in a geographic player. First, assign each route a unique identifier. Then, when plotting points on the routes using the情节定位对象函数,使用该路由标识符使用'trackId'名称值对参数。在此示例中,路线被标记为车辆1和车辆2。此屏幕捕获显示了两条路线即将在路径上的点。

Load data for a route.

数据=负载('georoute.mat');

Extract data for the first vehicle.

lat1 = data.latitude;lon1 = data.longitude;

创建一个synthetic route for the second vehicle that drives the same route in the opposite direction.

lat2 = flipud(lat1);lon2 = flipud(lon1);

创建一个geoplayer目的。初始化播放器以显示最后10个位置作为线路落后于当前位置的位置。

zoomLevel = 12; player = geoplayer(lat1(1),lon1(1),zoomLevel,...“历史记录”,10,'HistoryStyle',,,,'线');

两辆车在路线上移动时的位置。通过使用'trackId'名称值对参数。By default, thegeoplayer对象将车辆显示在第一条轨道上。您可以使用CenterOnIDproperty of thegeoplayer目的。

loopcounter =长度(lat1);为了i = 1:loopcounter plotposition(player,lat1(i),lon1(i),'trackId',,,,1,,,,“标签”,,,,'车辆1');plotposition(player,lat2(i),lon2(i),'trackId',,,,2,“标签”,,,,“车辆2”);结尾

Input Arguments

collapse all

Streaming geographic player, specified as ageoplayer目的。1

在地理播放器中显示的点的纬度坐标,该点在[–90,90]范围内指定为真实标量。

数据类型:单身的|double

在地理播放器中显示的点的经度坐标,该点在[–180,180]范围内指定为真实标量。

数据类型:单身的|double

名称值参数

Specify optional pairs of arguments asname1 = value1,...,namen = valuen,,,,where姓名是参数名称和Valueis the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名用引号。

Example:'Color','k'

该点的文本描述,指定为逗号分隔对“标签”以及字符向量或字符串标量。

Example:“标签”,'07:45:00 AM'

标记颜色,指定为逗号分隔对'Color'还有一个颜色名称,简短的颜色名称或RGB三胞胎。默认情况下,标记颜色是自动选择的。

对于自定义颜色,请指定RGB三重态。RGB三重态是一个三元素行矢量,其元素指定了颜色的红色,绿色和蓝色组件的强度。强度必须在范围内[0,1];例如,[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.

颜色姓名 颜色短名称 RGB三胞胎 Appearance
'红色的' 'r' [1 0 0]

Sample of the color red

'green' 'g' [0 1 0]

Sample of the color green

'blue' 'b' [0 0 1]

Sample of the color blue

'cyan' 'C' [0 1 1]

颜色青色样品

'magenta' 'm' [1 0 1]

颜色洋红色样品

'黄色' 'y' [1 1 0]

黄色样品

'黑色的' 'k' [0 0 0]

颜色黑色样品

'白色的' 'w' [1 1 1]

Sample of the color white

Example:'Color',[1 0 1]

Example:'Color','m'

Example:'Color','magenta'

标记符号,指定为逗号分隔对,由'Marker'这表中的标记之一。

标记 Description 结果标记
'o' 圆圈

圆形标记样品

'+' Plus sign

加号标记样品

'*' 星号

Sample of asterisk marker

'。' Point

点标记样本

'x' Cross

Sample of cross marker

'_' 水平线

水平线标记样品

'|' Vertical line

垂直线标记样品

' Square

Sample of square marker

'D' 钻石

Sample of diamond line marker

'^' Upward-pointing triangle

Sample of upward-pointing triangle marker

'v' 向下三角形

Sample of downward-pointing triangle marker

'>' 右点三角形

右点三角形标记的样本

'<' 左点三角形

左点三角形标记的样本

'P' Pentagram

Sample of pentagram marker

'h' hexagram

Sample of hexagram marker

标记的近似直径,指定为逗号分隔对,由'标记'和一个积极的真实标量。1分= 1/72英寸。大于6的标记尺寸可以降低渲染性能。

绘制轨道的唯一标识符,指定为正整数。当您绘制多个轨道时,请使用此值来识别单个轨道。当您指定此值时,此功能的所有其他名称值对参数仅适用于此唯一标识符指定的曲目。

Tips

  • When a vehicle's track goes outside of viewable area, the map automatically re-centers based on the value of thegeoplayerCenterOnID财产。

版本历史记录

在R2018A中引入

1Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®