Sagrada Família | Metro línia 5 (L5)
Accessos i enllaços
- Estació cardioprotegida
Circulació
Estació
iMetro - Propers metros
Darrera actualització ...
ActualitzarOcupació
Enllaços
Accessos
Incidències de circulació d’aquesta línia
Incidències d’estació
Ascensors
Darrera actualització ...
ActualitzarAltres elements d’estació
Mapa de la línia
© OpenStreetMap contributors
';
html += '
';
$(".imetro-content").append(html);
return;
}
HH = infoLine;
metroMap[lineCode] = infoLine;
//var lineName = infoLine[0].propers_trens[0].nom_linia;
var html = ''; html += calcLineIcon(nameLin); html += '
'; html += 'No hi ha previsions de pas disponibles. Disculpa les molèsties.
'; html += '';
// informacion linea
html += '
';
$(".imetro-content").append(html);
},
error : function(error){
console.log("ERROR");
}
});
}
function updateDialogImetro(codeLine,indexDirection){
var imetro = metroMap[codeLine][indexDirection];
//https://api.tmb.cat/v1/imetro/linia/'; html += calcLineIcon(nameLin); html += '
'; // sentidos o vias html += '- ';
infoLine.forEach(function(direction, indexDirection){
if(!direction.propers_trens || direction.propers_trens.length === 0 ){
return;
}
var destination = direction.propers_trens[0].desti_trajecte;
html += '
- ';
html += '
' + 'Destinació' + ' - ' + destination + '
'; //2 proximos trenes html += ''; direction.propers_trens.forEach(function(nextMetro){ html += '' + formatDate(nextMetro.temps_arribada, lastUpdateMetro.getTime()) + ''; }); html += ''; //2 proximos trenes html += '' + occupancyLevel + ''; html += ' ';
});
html += '
';
html += '
';
} else if(parseInt(capacityLevel) === 1){
image += '1-persona' + type + '.png" alt="Ocupació molt baixa" title="Ocupació molt baixa" />';
} else if(parseInt(capacityLevel) === 2){
image += '2-persones' + type + '.png" alt="Ocupació baixa" title="Ocupació baixa" />';
} else if(parseInt(capacityLevel) === 3){
image += '3-persones' + type + '.png" alt="Ocupació mitjana" title="Ocupació mitjana" />';
} else if(parseInt(capacityLevel) === 4){
image += '4-persones' + type + '.png" alt="Ocupació alta" title="Ocupació alta" />';
} else if(parseInt(capacityLevel) === 5){
image += '5-persones' + type + '.png" alt="Ocupació molt alta" title="Ocupació molt alta" />';
}
$('span.estimated-occupancy-txt-' + sentit).html(calcImgSubtitle(capacityLevel).toLowerCase());
return image;
}
function fillInCapacityImage(capacityLevel, index, totalLength){
var image = '
';
} else if(parseInt(capacityLevel) === 1){
image += type + 'molt-baixa' + '.svg" alt="Ocupació molt baixa" title="Ocupació molt baixa" />';
} else if(parseInt(capacityLevel) === 2){
image += type + 'baixa' + '.svg" alt="Ocupació baixa" title="Ocupació baixa" />';
} else if(parseInt(capacityLevel) === 3){
image += type + 'mitjana' + '.svg" alt="Ocupació mitjana" title="Ocupació mitjana" />';
} else if(parseInt(capacityLevel) === 4){
image += type + 'alta' + '.svg" alt="Ocupació alta" title="Ocupació alta" />';
} else if(parseInt(capacityLevel) === 5){
image += type + 'molt-alta' + '.svg" alt="Ocupació molt alta" title="Ocupació molt alta" />';
}
return image;
}
function calcImgSubtitle(capacityLevel){
if(parseInt(capacityLevel) === 1){
return 'Molt baixa';
} else if(parseInt(capacityLevel) === 2){
return 'Baixa';
} else if(parseInt(capacityLevel) === 3){
return 'Mitjana';
} else if(parseInt(capacityLevel) === 4){
return 'Alta';
} else if(parseInt(capacityLevel) === 5){
return 'Molt alta';
}
return '';
}
function formatDate(time, currentMilliseconds){
var diff = time - currentMilliseconds;
var diffSec = parseInt(diff / 1000);
var sec = diffSec % 60;
var min = (diffSec - sec) / 60;
if(min == 0 && sec < 15){
return "Imminent"
}
return min + " min " + sec + " sec";
}
function calcCapacityLevel(per){
if(per <= 20){
return 1;
} else if(per <= 30){
return 2;
} else if(per <= 40){
return 3;
} else if(per <= 50){
return 4;
} else if(per <= 100){
return 5;
}
return 0;
}
function calcLineIcon(metroLine){
var html = '';
if (metroLine.split("9")[1])
html = 'L9'
+''+metroLine.split("9")[1]+'';
else if (metroLine.split("10")[1])
html = 'L10'
+''+metroLine.split("10")[1]+'';
else
html = ''+metroLine+'';
return html;
}
function calcLineClass(metroLine){
var html = '';
if (metroLine.split("9")[1]){
html = "l9";
}else if (metroLine.split("10")[1]){
html = "l10";
}else{
html = metroLine.toLowerCase();
}
return html;
}
';
html += '';
html += '
';
html += '
'; //nivell-ocupacio
$(".imetro-dialog-content").html(html);
loadEstimatedOccupancy();
if(openModal){
TMB.dialog.newModal(langJotmbeClose, "dialog dialog--medium dialog--jotmbe__with-actions dialog--avis dialog--avis--home", "imetro-dialog", "");
} else if($('#dialog').length > 0){
TMB.dialog.open(true);
$('#dialog').find('a.last-update__update.button--update').focus();
}
}
function loadEstimatedOccupancy(){
if($(".estimated_occupancy").length == 0){
return;
}
var elementData = $(".estimated_occupancy")[0].dataset.estimated_occupancy.split("_");
var imetro = metroMap[elementData[0]][elementData[1]];
var day = new Date().getDay();
if(day === 0){
day = 7;
} else if(day<6){
day = 1;
}
var time = new Date().getHours();
var capacityUrl = varDomain + "/ocupacio/estacions/linia/" + imetro.codi_linia + "?app_id="+varTmbApiId+"&app_key="+varTmbApiKey + "&dia_setmana=" + day + "&index_hora=" + time + "&CODI_ESTACIO=" + imetro.codi_estacio + "&id_sentit=" + imetro.codi_via;
jQuery.ajax({
url : capacityUrl,
type : "GET",
dataType : "json",
async : true,
success : function(response) {
OOO = response;
var img = fillInCapacityImageEstimated(0, $(".estimated_occupancy")[0].dataset.estimated_occupancy);
if(response.features.length > 0){
img = fillInCapacityImageEstimated(response.features[0].properties.NIVELL_OCUPACIO, $(".estimated_occupancy")[0].dataset.estimated_occupancy);
}
$(".estimated_occupancy").html(img);
}
});
}
function fillInCapacityImageEstimated(capacityLevel, sentit){
var image = '';
html += '
' + stopName;
html += '
';
html += '';
html += '
'; //container
html += ''; //html += 'L1'; //html += 'L1'; //html += ''; html += calcLineIcon(lineName); html += 'Destinació - ' + destination; html += 'Actualitzar' html += '
'; html += '';
html += '
'; //item
html += '- ';
imetro.propers_trens.forEach(function(metro){
HHJJ = metro;
html += '
- ';
if(metro.info_tren.percentatge_ocupacio_cotxes && imetroConfig === 'REAL'){
html += '
Ocupació del metro en temps real
'; html += ''; metro.info_tren.percentatge_ocupacio_cotxes.forEach(function(percent,index){ //var per = arr_percent[k]; var imgSpan = fillInCapacityImage(calcCapacityLevel(percent), index, metro.info_tren.percentatge_ocupacio_cotxes.length); html += ''; html += imgSpan; html += '' + calcImgSubtitle(calcCapacityLevel(percent)) + ''; html += ''; }); }else{ //html += "Sense informació d’ocupació disponible"; var estimated_occupancy = codeLine + "_" + indexDirection; html += ''; //ocupacio html += 'Ocupació mitjana estimada del metro:
'; html += ''; html += '';//trens html += '...'; } html += '' + formatDate(metro.temps_arribada, lastUpdateMetro.getTime()) + '
'; html += ''; }); html += ''; html += '
 === 0){
image += 'sense-dades' + type + '.png)