public string SimplifyGPSTest() { Random r = new Random(); int index = r.Next(myUserTrajectories.GPSTrajectoriesData.Count); var path = myUserTrajectories.GPSTrajectoriesData[index]; string oldjson = GPSTrajectoryWriter.SingleTrajectoryToBaiduMapJson(path); //获取简化后的轨迹 GPSDouglasSimplification gds = new GPSDouglasSimplification(path, 20); var newpath = gds.Excute(); return(oldjson + "\n" + GPSTrajectoryWriter.SingleTrajectoryToBaiduMapJson(newpath)); }
public string TestRTree() { Random r = new Random(); int index = r.Next(myUserTrajectories.GPSTrajectoriesData.Count); StringBuilder roads = new StringBuilder(); var path = myUserTrajectories.GPSTrajectoriesData[index]; for (int i = 0; i < path.GPSCount; i++) { //这里的查询可以优化 var result = myRoadNetwork.RoadSegmentRtree.Query(new Envelope(path[i])); foreach (RoadSegment item in result) { roads.Append(item.ToString() + "\n"); } } return(GPSTrajectoryWriter.SingleTrajectoryToBaiduMapJson(path) + "\n" + roads.ToString()); }