feat: refs #7882 Fixed problems osrm service
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
e279cc4b47
commit
85baf151d9
|
@ -47,27 +47,26 @@ module.exports = Self => {
|
|||
const latitude = waypoint.location[1];
|
||||
|
||||
const matchedAddress = coords.find(coord =>
|
||||
!coord.position &&
|
||||
coord.position === undefined &&
|
||||
Math.abs(coord.latitude - latitude) <= tolerance &&
|
||||
Math.abs(coord.longitude - longitude) <= tolerance
|
||||
);
|
||||
if (matchedAddress)
|
||||
matchedAddress.position = waypoint.waypoint_index;
|
||||
else
|
||||
console.log(`Las coordenadas no se han podido asociar: ${latitude} | ${longitude}`);
|
||||
}
|
||||
coords.sort((a, b) => {
|
||||
const posA = a.position !== undefined ? a.position : Infinity;
|
||||
const posB = b.position !== undefined ? b.position : Infinity;
|
||||
return posA - posB;
|
||||
});
|
||||
// Temporal para abrir en maps
|
||||
|
||||
const coordsString = coords
|
||||
.map(item => `point=${item.latitude},${item.longitude}`)
|
||||
.join('&');
|
||||
console.log(`https://graphhopper.com/maps/?${coordsString}&profile=small_truck`);
|
||||
// ---------
|
||||
return coords;
|
||||
return {
|
||||
coords,
|
||||
view: `https://graphhopper.com/maps/?${coordsString}&profile=small_truck`
|
||||
};
|
||||
} catch (err) {
|
||||
switch (err.response?.data?.code) {
|
||||
case 'NoTrips':
|
||||
|
|
Loading…
Reference in New Issue