This commit is contained in:
2026-06-07 12:50:04 +02:00
parent eb64b8f2f9
commit 9189f54df5
7 changed files with 126 additions and 9 deletions
+9 -2
View File
@@ -209,7 +209,13 @@ func parseEntityHeader(line string) *Entity {
e.CQZone, _ = strconv.Atoi(strings.TrimSpace(parts[1]))
e.ITUZone, _ = strconv.Atoi(strings.TrimSpace(parts[2]))
e.Lat, _ = strconv.ParseFloat(strings.TrimSpace(parts[4]), 64)
e.Lon, _ = strconv.ParseFloat(strings.TrimSpace(parts[5]), 64)
// cty.dat longitude is "+ for West" (e.g. France 2°E = -2.00, USA 92°W =
// +91.87). Negate it to the standard "+ for East" the rest of the app uses
// (grids, bearing/distance math), otherwise every cty.dat-derived azimuth and
// cluster distance is mirrored east↔west.
if lon, err := strconv.ParseFloat(strings.TrimSpace(parts[5]), 64); err == nil {
e.Lon = -lon
}
e.TZOffset, _ = strconv.ParseFloat(strings.TrimSpace(parts[6]), 64)
if e.Name == "" {
return nil
@@ -241,7 +247,8 @@ func parsePrefix(s string, e *Entity) (prefixEntry, bool) {
lat, e1 := strconv.ParseFloat(a, 64)
lon, e2 := strconv.ParseFloat(b, 64)
if e1 == nil && e2 == nil {
out.latOverride, out.lonOverride = lat, lon
// Same "+ for West" → "+ for East" flip as the entity header.
out.latOverride, out.lonOverride = lat, -lon
out.hasLatLon = true
}
}