情节定位
显示当前位置geoplayer
数字
Description
情节定位(
usesplayer
,,,,lat
,,,,lon
,,,,姓名,,,,Value
)姓名,,,,Value
pair arguments to modify aspects of the plotted points.
For example,绘制位置(播放器,45,0,'颜色','w','marker','*')
plots a point in thegeoplayer
数字as a white star.
Examples
View Position of Vehicle Along Route
加载一系列纬度和经度坐标。
数据=负载('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
对象将车辆显示在第一条轨道上。您可以使用CenterOnID
property 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
lat
-Latitude coordinate
real scalar in the range [–90, 90]
在地理播放器中显示的点的纬度坐标,该点在[–90,90]范围内指定为真实标量。
数据类型:单身的
|double
lon
-Longitude coordinate
在范围内的真实标量[–180,180]
在地理播放器中显示的点的经度坐标,该点在[–180,180]范围内指定为真实标量。
数据类型:单身的
|double
名称值参数
Specify optional pairs of arguments asname1 = value1,...,namen = valuen
,,,,where姓名
是参数名称和Value
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名
用引号。
Example:'Color','k'
标签
-Text description
''
(默认)|character vector|字符串标量
该点的文本描述,指定为逗号分隔对“标签”
以及字符向量或字符串标量。
Example:“标签”,'07:45:00 AM'
颜色
-标记color
颜色名称|颜色名称|RGB triplet
标记颜色,指定为逗号分隔对'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] |
|
'green' |
'g' |
[0 1 0] |
|
'blue' |
'b' |
[0 0 1] |
|
'cyan' |
'C' |
[0 1 1] |
|
'magenta' |
'm' |
[1 0 1] |
|
'黄色' |
'y' |
[1 1 0] |
|
'黑色的' |
'k' |
[0 0 0] |
|
'白色的' |
'w' |
[1 1 1] |
|
Example:'Color',[1 0 1]
Example:'Color','m'
Example:'Color','magenta'
标记
-标记symbol
'o'
(默认)|'+'
|'*'
|'。'
|'x'
|...
标记符号,指定为逗号分隔对,由'Marker'
这表中的标记之一。
标记 | Description | 结果标记 |
---|---|---|
'o' |
圆圈 |
|
'+' |
Plus sign |
|
'*' |
星号 |
|
'。' |
Point |
|
'x' |
Cross |
|
'_' |
水平线 |
|
'|' |
Vertical line |
|
' |
Square |
|
'D' |
钻石 |
|
'^' |
Upward-pointing triangle |
|
'v' |
向下三角形 |
|
'>' |
右点三角形 |
|
'<' |
左点三角形 |
|
'P' |
Pentagram |
|
'h' |
hexagram |
|
标记
-标记的直径
6
(默认)|positive real scalar
标记的近似直径,指定为逗号分隔对,由'标记
'和一个积极的真实标量。1分= 1/72英寸。大于6的标记尺寸可以降低渲染性能。
TrackID
-Unique identifier for plotted track
1
(默认)|正整数
绘制轨道的唯一标识符,指定为正整数。当您绘制多个轨道时,请使用此值来识别单个轨道。当您指定此值时,此功能的所有其他名称值对参数仅适用于此唯一标识符指定的曲目。
Tips
When a vehicle's track goes outside of viewable area, the map automatically re-centers based on the value of the
geoplayer
CenterOnID
财产。
版本历史记录
1Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®。
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
您单击了与此MATLAB命令相对应的链接:
运行该命令输入in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
选择一个网站以获取可用的翻译内容,并查看本地事件和优惠。根据您的位置,我们建议您选择:。
You can also select a web site from the following list:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
Americas
- América Latina(Español)
- Canada(English)
- United States(English)