forked from TDTP/admin_transporte_frontend
cambios sabado 2 de marzo 2024
parent
bd5f5d4b45
commit
08ce21218e
|
@ -85,8 +85,12 @@
|
|||
}
|
||||
if (!myMap) {
|
||||
myMap = L.map(elMap)
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
{ attribution: '© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }
|
||||
L.tileLayer(
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
{
|
||||
maxZoom: 19,
|
||||
attribution: '© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}
|
||||
).addTo(myMap);
|
||||
}
|
||||
|
||||
|
@ -114,7 +118,11 @@
|
|||
|
||||
const coordenadas = data.positions.map(({ shape_pt_lat, shape_pt_lon}) => [shape_pt_lat, shape_pt_lon])
|
||||
polyline = L.polyline(coordenadas, { color: 'red' }).addTo(myMap)
|
||||
myMap.fitBounds(polyline.getBounds());
|
||||
|
||||
const bound = polyline.getBounds()
|
||||
if (bound._northEast && bound._southWset) {
|
||||
myMap.fitBounds(polyline.getBounds());
|
||||
}
|
||||
|
||||
if (coordenadas) {
|
||||
marker1 = L.marker(coordenadas[0], { icon: iconPartida }).addTo(myMap)
|
||||
|
@ -124,6 +132,7 @@
|
|||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log({ error })
|
||||
globalThis.toast.error(error)
|
||||
} finally {
|
||||
loading = false;
|
||||
|
|
Loading…
Reference in New Issue