public static void UpdateTripElevation(int startPos, int maxPosId) { if (startPos == 0 || maxPosId == 0) { return; } Logfile.Log($"UpdateTripElevation start:{startPos} ende:{maxPosId}"); String inhalt = ""; try { //SRTM.Logging.LogProvider.SetCurrentLogProvider(SRTM.Logging.Logger.) var srtmData = new SRTM.SRTMData(FileManager.GetSRTMDataPath()); DataTable dt = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter($"SELECT id, lat, lng, odometer FROM pos where id > {startPos} and id < {maxPosId} and speed > 0 and altitude is null and lat is not null and lng is not null and lat > 0 and lng > 0 order by id", DBConnectionstring); da.Fill(dt); int x = 0; foreach (DataRow dr in dt.Rows) { string sql = null; try { System.Threading.Thread.Sleep(1); double latitude = (double)dr[1]; double longitude = (double)dr[2]; int?height = srtmData.GetElevation(latitude, longitude); if (height != null && height < 8000 && height > -428) { ExecuteSQLQuery($"update pos set altitude={height} where id={dr[0]}"); } x++; if (x > 250) { x = 0; Logfile.Log($"UpdateTripElevation ID:{dr[0]}"); } } catch (Exception ex) { Logfile.ExceptionWriter(ex, sql); } } } catch (Exception ex) { Logfile.ExceptionWriter(ex, inhalt); Logfile.Log(ex.ToString()); } Logfile.Log($"UpdateTripElevation finished start:{startPos} ende:{maxPosId}"); }