Untwikkeldersplatfoarm fan Mariner GPS Tools
Begjinkoers berekkenje
Berekkenje de wiere begjinkoers fan de iene posysje nei de oare.
Ynterfaces
POST
REST einpunt
/api/v1/bearingMCP
Arknamme
calculate_bearingFersyk
Stjoer it fersyk as JSON. MCP-kliïnten jouwe deselde fjilden troch as arkarguminten.
cURLshell
curl -X POST https://marinergps.tools/api/v1/bearing \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"from": {
"lat": 50.1,
"lng": -4.2
},
"to": {
"lat": 49.8,
"lng": -3.1
}
}'Fersyklichemjson
{
"from": {
"lat": 50.1,
"lng": -4.2
},
"to": {
"lat": 49.8,
"lng": -3.1
}
}Antwurd
REST ferpakt it berekkeningsresultaat yn de standert súksesenvelop. MCP jout deselde berekkeningsgegevens as strukturearre arkútfier werom.
JSON
{
"ok": true,
"data": {
"degrees": 112.54786806700503,
"compass": "ESE"
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}Skema's
De definysjes hjirûnder litte it folsleine JSON-skema sjen dat brûkt wurdt om ynfier te falidearjen en útfier te beskriuwen.
Ynfierskema
{
"type": "object",
"additionalProperties": false,
"properties": {
"from": {
"type": "object",
"additionalProperties": false,
"properties": {
"lat": {
"type": "string",
"description": "Latitude as decimal degrees or a coordinate string such as 51° 30′ 26.4″ N."
},
"lng": {
"type": "string",
"description": "Longitude as decimal degrees or a coordinate string such as 0° 07′ 39″ W."
}
},
"required": [
"lat",
"lng"
]
},
"to": {
"type": "object",
"additionalProperties": false,
"properties": {
"lat": {
"type": "string",
"description": "Latitude as decimal degrees or a coordinate string such as 51° 30′ 26.4″ N."
},
"lng": {
"type": "string",
"description": "Longitude as decimal degrees or a coordinate string such as 0° 07′ 39″ W."
}
},
"required": [
"lat",
"lng"
]
}
},
"required": [
"from",
"to"
]
}Utfierskema
{
"type": "object",
"additionalProperties": false,
"properties": {
"degrees": {
"type": "number"
},
"compass": {
"type": "string"
}
},
"required": [
"degrees",
"compass"
]
}