如何动态添加KML坐标点和计算速度

道吾青尘 2012-05-17 12:13:51
文件结构我已经能生成出来 也可用了 具体代码该怎么写
...全文
144 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
道吾青尘 2012-05-21
  • 打赏
  • 举报
回复
//插入数据
string path = @"E:\niu.kml";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(path);
XmlNode xn = xmlDoc.SelectSingleNode("kml/Document");

XmlElement pl = xmlDoc.CreateElement("Placemark");
xn.AppendChild(pl);

XmlElement des = xmlDoc.CreateElement("description");
des.InnerText = "Time:" + System.DateTime.Now.ToString() + " Coord:" + xx.ToString() + "," + yy.ToString() + " Speed:" + "23km/h";//设置节点文本
pl.AppendChild(des);//添加到<Placemark>节点中

XmlElement poi = xmlDoc.CreateElement("Point");
pl.AppendChild(poi);

XmlElement coor = xmlDoc.CreateElement("coordinates");
coor.InnerText = xx.ToString() + "," + yy.ToString() + " ";
poi.AppendChild(coor);

xmlDoc.Save(path);
xx += 0.003;
yy += 0.002;

汗 都没人来帮忙
自己找到了 谁来回个帖 分还有人要不咯

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧