private static void ExportByLocation() { var lat = GetDoubleFromUser("Latitude?"); var lon = GetDoubleFromUser("Longitude?"); var distance = GetDoubleFromUser("Radius (in kilometers)?"); var fileName = GetStringFromUser("Filename?"); var format = GetStringFromUser("Format (KML or CHIRP)?"); var coordinates = new Coordinates(lat, lon); Console.WriteLine($"Filtering data by: Latitude:{lat}, Longitude:{lon} with a radius of {distance}."); var filterByLocation = DataManager.FilterByLocation(coordinates, distance, UnitOfLength.Kilometers); Console.WriteLine($"Filtering data complete. Found:{filterByLocation.Count} locations"); if (filterByLocation.Count <= 0) { Console.WriteLine("Nothing to export. Aborting..."); return; } if (format.Equals("KML", StringComparison.InvariantCultureIgnoreCase)) { var kml = new KMLExporter(); kml.ExportFolders(fileName, filterByLocation); } else { var chirp = new ChirpExporter(); chirp.ExportFolders(fileName, filterByLocation); } Console.WriteLine($"Done writing data to the file:{fileName}, exiting."); }
private static void Main(string[] args) { DataManager.Initialize(); var user = DataManager.FindAll(entry => entry.Call.Equals("VE7NKL") || entry.Call.Equals("VE7 NKL")); if (args != null && args.Any() && args[0] == "custom") { var coordinates = new Coordinates(53.169060, -121.04757); var filterByCoords = DataManager.FilterByLocation(coordinates, 100, UnitOfLength.Kilometers); var kml = new KMLExporter(); kml.ExportFolders(@"C:\Users\rchartier\Desktop\exported_kml.kml", filterByCoords); var chrip = new ChirpExporter(); chrip.ExportFolders(@"C:\Users\rchartier\Desktop\exported_chirp.csv", filterByCoords); var filterByLocation = DataManager.FindAll(entry => entry.Province.Equals("BC", StringComparison.InvariantCultureIgnoreCase) || entry.Province.Equals("AB", StringComparison.InvariantCultureIgnoreCase)); ExportCustomCSV(filterByLocation); //ExportChirp(filterByLocation); //ExportKML(filterByLocation); Console.WriteLine("Done"); Console.ReadLine(); } else { ExportByLocation(); } }
private static void ExportChirp(IEnumerable <Entry> filterByLocation) { var chirp = new ChirpExporter(); chirp.ExportFolders(@"C:\Users\rchartier\Desktop\exported_chrip.csv", filterByLocation); }