Update: 2026-07-06 01:20:19
This commit is contained in:
@@ -17,19 +17,8 @@
|
||||
* @return array|null Returns ['distance_km' => float, 'duration_min' => float] or null on failure.
|
||||
*/
|
||||
function getOsrmRouteDetails($startLat, $startLng, $endLat, $endLng, $countryCode = 'JO') {
|
||||
// Select Intaleq Maps SaaS server based on country
|
||||
switch (strtoupper($countryCode)) {
|
||||
case 'SY':
|
||||
$baseUrl = "https://map-syria.siromove.com/api/maps/route";
|
||||
break;
|
||||
case 'EG':
|
||||
$baseUrl = "https://map-egypt.siromove.com/api/maps/route";
|
||||
break;
|
||||
case 'JO':
|
||||
default:
|
||||
$baseUrl = "https://map-saas.intaleqapp.com/api/maps/route";
|
||||
break;
|
||||
}
|
||||
// Intaleq Maps SaaS server handles all countries (Jordan, Syria, Egypt)
|
||||
$baseUrl = "https://map-saas.intaleqapp.com/api/maps/route";
|
||||
|
||||
$queryParams = http_build_query([
|
||||
'fromLat' => $startLat,
|
||||
@@ -58,7 +47,7 @@ function getOsrmRouteDetails($startLat, $startLng, $endLat, $endLng, $countryCod
|
||||
$data = json_decode($response, true);
|
||||
if (isset($data['distance']) && isset($data['duration'])) {
|
||||
$distanceMeters = (float)$data['distance'];
|
||||
$durationSeconds = (float)$data['duration'];
|
||||
$durationSeconds = isset($data['trafficAwareDuration']) ? (float)$data['trafficAwareDuration'] : (float)$data['duration'];
|
||||
|
||||
return [
|
||||
'distance_km' => round($distanceMeters / 1000, 2),
|
||||
|
||||
Reference in New Issue
Block a user