POST/api/distance/calculateنیاز به احراز هویت
فاصله جادهای بین دو نقطه را با استفاده از مسیریابی OSRM محاسبه میکند. فاصلههای کمتر از ۱۰ کیلومتر بهصورت صفر گزارش میشوند — این سرویس برای قیمتگذاری بینشهری تنظیم شده، نه مسیرهای کوتاه داخلشهری.
| پارامتر | محل | نوع | الزامی |
|---|---|---|---|
originنقطه مبدأ (عرض,طول جغرافیایی) | body | string | اختیاری |
destinationنقطه مقصد (عرض,طول جغرافیایی) | body | string | اختیاری |
routingProviderموتور مسیریابی مورد استفاده (اختیاری) | body | string | اختیاری |
curl -s -X POST "https://ors.shoofer.taxi/api/distance/calculate" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "origin": "35.6892,51.3890", "destination": "36.2605,59.6168" }'const res = await fetch("https://ors.shoofer.taxi/api/distance/calculate", {
method: "POST",
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({ origin: "35.6892,51.3890", destination: "36.2605,59.6168" })
});
const { distance } = await res.json();resp = requests.post(
"https://ors.shoofer.taxi/api/distance/calculate",
headers={"Authorization": f"Bearer {token}"},
json={"origin": "35.6892,51.3890", "destination": "36.2605,59.6168"},
)
distance = resp.json()["distance"]var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var res = await client.PostAsJsonAsync("https://ors.shoofer.taxi/api/distance/calculate", new
{
origin = "35.6892,51.3890",
destination = "36.2605,59.6168"
});
var body = await res.Content.ReadFromJsonAsync<JsonElement>();
var distance = body.GetProperty("distance").GetDouble();نمونه پاسخ
{
"origin": "35.6892,51.3890",
"destination": "36.2605,59.6168",
"distance": 895.4,
"success": true
}.png)