gchq/CyberChef · error · OperationError

Invalid co-ordinate format for Degrees Decimal Minutes.

Error message

Invalid co-ordinate format for Degrees Decimal Minutes.

What it means

Thrown in the 'Degrees Decimal Minutes' branch when isPair is true but splitInput of either segment does not return exactly 2 numeric parts. DDM requires exactly degrees and decimal-minutes for BOTH halves.

Source

Thrown at src/core/lib/ConvertCoordinates.mjs:179

                    throw new OperationError("Invalid co-ordinate format for Degrees Minutes Seconds");
                }
            } else {
                // Not a pair, so only try to convert one set of co-ordinates
                splitLat = splitInput(split[0]);
                if (splitLat.length >= 3) {
                    lat = convDMSToDD(splitLat[0], splitLat[1], splitLat[2]);
                    latlon = new LatLonEllipsoidal(lat.degrees, lat.degrees);
                } else {
                    throw new OperationError("Invalid co-ordinate format for Degrees Minutes Seconds");
                }
            }
            break;
        case "Degrees Decimal Minutes":
            if (isPair) {
                splitLat = splitInput(split[0]);
                splitLong = splitInput(split[1]);
                if (splitLat.length !== 2 || splitLong.length !== 2) {
                    throw new OperationError("Invalid co-ordinate format for Degrees Decimal Minutes.");
                }
                // Convert to decimal degrees, and then convert to a geodesy object
                lat = convDDMToDD(splitLat[0], splitLat[1], 10);
                lon = convDDMToDD(splitLong[0], splitLong[1], 10);
                latlon = new LatLonEllipsoidal(lat.degrees, lon.degrees);
            } else {
                // Not a pair, so only try to convert one set of co-ordinates
                splitLat = splitInput(input);
                if (splitLat.length !== 2) {
                    throw new OperationError("Invalid co-ordinate format for Degrees Decimal Minutes.");
                }
                lat = convDDMToDD(splitLat[0], splitLat[1], 10);
                latlon = new LatLonEllipsoidal(lat.degrees, lat.degrees);
            }
            break;
        case "Decimal Degrees":
            if (isPair) {
                splitLat =  splitInput(split[0]);

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Make sure each half of the pair has exactly two numeric components: degrees and decimal minutes.
  2. If seconds are present, switch inFormat to 'Degrees Minutes Seconds'.
  3. If only a single decimal value per half is available, use 'Decimal Degrees'.

Example fix

// before
convertCoordinates("51 30 26, 0 7 39", "Degrees Decimal Minutes", "Comma", ...);
// 3 numbers each -> throws

// after
convertCoordinates("51 30.433, 0 7.650", "Degrees Decimal Minutes", "Comma", ...);
Defensive patterns

Strategy: validation

Validate before calling

function splitInput(s){return s.split(/\s+/).map(x=>x.replace(/[^0-9.-]/g,"")).filter(Boolean).map(Number);}
if (splitInput(split[0]).length !== 2 || splitInput(split[1]).length !== 2) {
  throw new Error("DDM pair needs exactly degrees and decimal-minutes per half.");
}

Prevention

When it happens

Trigger: inFormat='Degrees Decimal Minutes' with a paired input where one half has only degrees (1 number) or has 3+ numbers (e.g. leftover seconds), so splitLat.length !== 2 or splitLong.length !== 2.

Common situations: Mixing DDM with DMS data (extra seconds field present); one coordinate given as plain decimal degrees (single number); inconsistent delimiters collapsing one field to zero numbers.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/46cd8984234a116a. Report an issue: GitHub.