private static void GPSTraceToShp() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "文本文件|*.txt;*.csv"; ofd.RestoreDirectory = true; if (ofd.ShowDialog() == DialogResult.OK) { Console.WriteLine("Application thread ID: {0}", Thread.CurrentThread.ManagedThreadId); var gpsData = GPSIO.GPSTrajectoryReader.ReadAll(ofd.FileName); var t = Task.Run(() => { GPSTrajectoryWriter.ExportGPSTrajectoriesToShapefile("GPSTraces.shp", gpsData.GPSTrajectoriesData); Console.WriteLine("Data Transform Completed!"); Console.ReadKey(); }); Console.Write("Please wait for completition"); t.Wait(); } }
/// <summary> /// 导出轨迹数据到shapefile /// </summary> public void ExportGPSData() { GPSTrajectoryWriter.ExportGPSTrajectoriesToShapefile("GPSShapefile.shp", myUserTrajectories.GPSTrajectoriesData); MessageBox.Show("导出数据完成!"); }