{
  "openapi": "3.1.1",
  "info": {
    "title": "RavingDesk Coordinate Converter (DMS, UTM, MGRS, plus codes) API",
    "version": "1.0.0",
    "summary": "Convert coordinates between DD, DMS, UTM/UPS, MGRS, geohash, Maidenhead and plus codes.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://ravingdeskcoordinateconverter.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Convert coordinates between DD, DMS, UTM/UPS, MGRS, geohash, Maidenhead and plus codes.",
        "description": "Reads coordinates in almost any notation — decimal degrees, degrees-minutes-seconds with hemisphere letters, UTM or UPS, MGRS grid references, geohashes, Maidenhead locators, plus codes or Web Mercator metres — and writes each one in every other format, with the UTM zone (including the Norway and Svalbard exceptions), meridian convergence and scale factor. Up to 500 lines at once, with a CSV table for spreadsheets. It is the coordinate engine of RavingDesk’s Data & charts geo layer.\n\nMethodology:\n- Latitude/longitude text is read tolerantly: decimal degrees, DMS and DDM with °, ′, ″ (or d, m, s, apostrophes), hemisphere letters before or after the numbers, minus signs, and decimal commas when the two values are separated by a semicolon.\n- UTM uses the transverse Mercator projection with Krüger’s series to 6th order in the third flattening (Karney 2011: accuracy better than 5 nm within the zone), k₀ = 0.9996, false easting 500 km and false northing 10,000 km south of the equator. Zones follow the Norway (32V) and Svalbard (31X–37X) exceptions. North of 84°N and south of 80°S the polar stereographic UPS (k₀ = 0.994) is used.\n- MGRS uses the standard (AA) lettering of NGA.STND.0037 and truncates to the chosen precision, as the standard requires; MGRS in the polar UPS areas is not supported. Plus codes follow the Open Location Code specification; geohash interleaves longitude/latitude bits in base 32; Maidenhead uses fields, squares and subsquares.\n- Grid codes (MGRS, plus codes, geohashes, locators) stand for a square: the latitude/longitude shown is the centre of that square and the cell size is reported.\n- Web Mercator (EPSG:3857) treats the Earth as a sphere of 6,378,137 m; it is for web maps, not for measuring.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ravingdesk_coordinate_converter",
        "x-owner-app": "ravingdesk",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RavingdeskCoordinateConverterInput"
              },
              "examples": {
                "example1": {
                  "summary": "Berlin, Paris (DMS) and the Washington Monument (MGRS)",
                  "value": {
                    "coordinates": "52.520008, 13.404954\n48°51′29.6″N 2°17′40.2″E\n18S UJ 23487 06483"
                  }
                },
                "example2": {
                  "summary": "UTM to latitude/longitude, including Bergen in the Norway zone 32V",
                  "value": {
                    "coordinates": "33U 391779 5820072\n32V 297477 6700830\n56H 334369 6250948"
                  }
                },
                "example3": {
                  "summary": "Grid codes: plus code, Maidenhead locator, MGRS on Svalbard",
                  "value": {
                    "coordinates": "8FVC9G8F+6X\nFN31pr\n33X WG 14278 83355"
                  }
                },
                "example4": {
                  "summary": "Geohashes (format named, since geohash text is ambiguous)",
                  "value": {
                    "coordinates": "u33dc0cpp\nu4pruydqqvj",
                    "from": "geohash"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RavingdeskCoordinateConverterResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RavingdeskCoordinateConverterInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "coordinates": {
            "title": "Coordinates (one per line)",
            "description": "Up to 500 lines. Each line is converted on its own; a line that cannot be read is reported and skipped.",
            "type": "string",
            "maxLength": 60000,
            "default": "52.520008, 13.404954\n48°51′29.6″N 2°17′40.2″E\n18S UJ 23487 06483"
          },
          "from": {
            "title": "Input format",
            "type": "string",
            "enum": [
              "auto",
              "latlon",
              "lonlat",
              "utm",
              "mgrs",
              "geohash",
              "maidenhead",
              "pluscode",
              "webmercator"
            ],
            "default": "auto"
          },
          "mgrsDigits": {
            "title": "MGRS precision (digits per axis)",
            "description": "5 = 1 m, 4 = 10 m, 3 = 100 m.",
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 5
          },
          "plusCodeLength": {
            "title": "Plus code length",
            "description": "10 digits ≈ 14 m × 14 m, 11 ≈ 3.5 m × 2.8 m.",
            "type": "integer",
            "minimum": 8,
            "maximum": 15,
            "default": 10
          },
          "geohashLength": {
            "title": "Geohash length",
            "description": "9 characters ≈ 4.8 m × 4.8 m.",
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "default": 9
          }
        },
        "required": [
          "coordinates"
        ]
      },
      "RavingdeskCoordinateConverterResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "items",
              "converted",
              "failed"
            ],
            "properties": {
              "converted": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "line",
                    "input",
                    "ok"
                  ],
                  "properties": {
                    "line": {
                      "type": "integer"
                    },
                    "input": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "readAs": {
                      "type": "string"
                    },
                    "cellSizeM": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "lat": {
                      "type": "number"
                    },
                    "lon": {
                      "type": "number"
                    },
                    "dd": {
                      "type": "string"
                    },
                    "dms": {
                      "type": "string"
                    },
                    "ddm": {
                      "type": "string"
                    },
                    "utm": {
                      "type": "string"
                    },
                    "utmZone": {
                      "type": "integer"
                    },
                    "utmBand": {
                      "type": "string"
                    },
                    "utmSystem": {
                      "type": "string",
                      "enum": [
                        "UTM",
                        "UPS"
                      ]
                    },
                    "easting": {
                      "type": "number"
                    },
                    "northing": {
                      "type": "number"
                    },
                    "convergenceDeg": {
                      "type": "number"
                    },
                    "scaleFactor": {
                      "type": "number"
                    },
                    "mgrs": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "geohash": {
                      "type": "string"
                    },
                    "maidenhead": {
                      "type": "string"
                    },
                    "plusCode": {
                      "type": "string"
                    },
                    "webMercatorX": {
                      "type": "number"
                    },
                    "webMercatorY": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}