public void getDecimalCoordsDDTest() { //we assume our coordinates are already validated using coordsAreValid() DataRow row = getTestCoordsRow(); row["lat"] = "24.24578"; row["long"] = "32.25479"; row["llunit"] = "DD"; row["llres"] = "250m"; row["ew"] = "E"; row["ns"] = "S"; string coords = RecordErrorFinder.getDecimalCoords(row); Assert.AreEqual(coords, "-24.24578, 32.25479"); }
//add quarter degree squares from coords - should only happen after coordinates have been cleaned. public static int addQDSFromCoordinates(DataTable records) { int updates = 0; foreach (DataRow row in records.Rows) { string qds = row["qds"].ToString().Trim(); if (String.IsNullOrEmpty(qds)) { try { string coords = RecordErrorFinder.getDecimalCoords(row); row["qds"] = RecordErrorFinder.getQDSFromCoords(coords); updates++; } catch { continue; } } } return(updates); }