Platfform Datblygwr Mariner GPS Tools
Dehongli a fformatio cyfesurynnau
Trosi rhwng graddau degol a graddau, munudau, a eiliadau (DMS).
Rhyngwynebau
POST
Pwynt diwedd REST
/api/v1/coordinates/convertMCP
Enw offeryn
convert_coordinatesCais
Anfonwch y cais fel JSON. Mae cleientiaid MCP yn pasio'r un meysydd ag argumentau'r offeryn.
cURLshell
curl -X POST https://marinergps.tools/api/v1/coordinates/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"latitude": "51.5074",
"longitude": "-0.1278",
"format": "dms"
}'Corff y caisjson
{
"latitude": "51.5074",
"longitude": "-0.1278",
"format": "dms"
}Ymateb
Mae REST yn amgáu canlyniad y cyfrifiad yn yr amlen lwyddiant safonol. Mae MCP yn dychwelyd yr un data cyfrifo fel allbwn offeryn strwythuredig.
JSON
{
"ok": true,
"data": {
"latitude": {
"decimal": 51.5074,
"formatted": "51° 30′ 26.640″ N"
},
"longitude": {
"decimal": -0.1278,
"formatted": "0° 07′ 40.080″ W"
},
"format": "dms"
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}Sgemâu
Mae'r diffiniadau isod yn dangos y JSON Schema cyflawn a ddefnyddir i ddilysu mewnbynnau a disgrifio allbynnau.
Cynllun mewnbwn
{
"type": "object",
"additionalProperties": false,
"properties": {
"latitude": {
"type": "string",
"description": "Latitude as decimal degrees or DMS text."
},
"longitude": {
"type": "string",
"description": "Longitude as decimal degrees or DMS text."
},
"format": {
"type": "string",
"enum": [
"decimal",
"dms"
],
"description": "Output coordinate format."
}
},
"required": [
"latitude",
"longitude",
"format"
]
}Cynllun allbwn
{
"type": "object",
"additionalProperties": false,
"properties": {
"latitude": {
"type": "object",
"additionalProperties": false,
"properties": {
"decimal": {
"type": "number"
},
"formatted": {
"type": "string"
}
},
"required": [
"decimal",
"formatted"
]
},
"longitude": {
"type": "object",
"additionalProperties": false,
"properties": {
"decimal": {
"type": "number"
},
"formatted": {
"type": "string"
}
},
"required": [
"decimal",
"formatted"
]
},
"format": {
"type": "string",
"enum": [
"decimal",
"dms"
]
}
},
"required": [
"latitude",
"longitude",
"format"
]
}