pos matlab,MATLAB版本pos2kml

有些时候需要展示一下行车轨迹,但是直接画图结果并不直观,而且也没有环境支撑,效果并不好。而google earth提供一种公开标准的kml/kmz文件,可以通过将行车轨迹坐标转成该文件格式,从而实现基于google earth的行车轨迹展示。

rtklib已经存在pos2kml的函数及其功能,但是考虑到在matlab调用并不方便,还需要使用文本作为转换媒介,而kml文件结构也并不复杂,故此处重写了matlab版本的pos2mal,能基本实现位置展示及使用不同的颜色代表不同的属性。

使用方法如下:

pos2kml(lat,lon,hgt,att,out_file)

% brief Generate google earth kml file

% Input: lat (nx1,double) : latitude vector

% lon (nx1,double) : longitude vector

% hgt (nx1,double or []) : height vector

% att (nx1,integer or []) : attributes vector, stand for

% different color points, only 7 color supported.

% out_file (string) : out kml file path and name

% Call Example:

% 1. pos2kml(lat,lon,[],[],'out.kml');

% 2. pos2kml(lat,lon,[],ones(length(lat),1),'out.kml');

该函数会直接生 out.kml

文件(建议添加 .kml

尾辍,方便google earth识别),然后使用google earth打开该文件即可。

代码已托管至github, 下载地址如下:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值