agrobot_base/AgroBase/AgroBase/bin/Debug/Python/Output/mapa_interativo.html

401 lines
25 KiB
HTML
Raw Blame History

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
<script src="folium/leaflet.js"></script>
<script src="folium/jquery-3.7.1.min.js"></script>
<script src="folium/bootstrap.bundle.min.js"></script>
<script src="folium/leaflet.awesome-markers.js"></script>
<link rel="stylesheet" href="folium/leaflet.css"/>
<link rel="stylesheet" href="folium/bootstrap.min.css"/>
<link rel="stylesheet" href="folium/bootstrap.min.css"/>
<link rel="stylesheet" href="folium/all.min.css"/>
<link rel="stylesheet" href="folium/leaflet.awesome-markers.css"/>
<link rel="stylesheet" href="folium/leaflet.awesome.rotate.min.css"/>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_3e3ecf608b53aa6268b796f9f5e08542 {
position: relative;
width: 100.0%;
height: 100.0%;
left: 0.0%;
top: 0.0%;
}
.leaflet-container { font-size: 1rem; }
</style>
</head>
<body>
<div class="folium-map" id="map_3e3ecf608b53aa6268b796f9f5e08542" ></div>
</body>
<script>
var map_3e3ecf608b53aa6268b796f9f5e08542 = L.map(
"map_3e3ecf608b53aa6268b796f9f5e08542",
{
center: [-22.172633165083333, -47.39518732516667],
crs: L.CRS.EPSG3857,
zoom: 12,
zoomControl: true,
preferCanvas: false,
}
);
var tile_layer_a06cee75255afedb079ea7f4d9dba08a = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
);
tile_layer_a06cee75255afedb079ea7f4d9dba08a.addTo(map_3e3ecf608b53aa6268b796f9f5e08542);
var trajetosSelecionados = {};
var RuasSelecionadas = [];
function enviarSelecaoParaServidor() {
client.publish("selecao_ruas_mapa", JSON.stringify(RuasSelecionadas), function (err) {
/*if (!err) {
console.log("Mensagem publicada com sucesso");
} else {
console.error("Falha ao publicar mensagem", err);
}*/
});
}
function geo_json_66b1efbb9a28b321c2fa400e06abb4dd_onEachFeature(feature, layer) {
layer.on({
click: function(e) {
// Verificar se o trajeto j<> est<73> selecionado
if (trajetosSelecionados[feature.id]) {
// Se j<> est<73> selecionado, reverta para a cor original e remova da sele<6C><65>o
e.target.setStyle({
color: '#3388ff' // Cor original
});
delete trajetosSelecionados[feature.id];
RuasSelecionadas.splice(RuasSelecionadas.indexOf(feature.id), 1);
} else {
// Se n<>o est<73> selecionado, mude a cor para indicar sele<6C><65>o e adicione ao objeto de sele<6C><65>o
e.target.setStyle({
color: 'blue' // Cor de sele<6C><65>o
});
trajetosSelecionados[feature.id] = true;
RuasSelecionadas.push(feature.id);
}
enviarSelecaoParaServidor();
}/*, mouseover: function(e) {
// Mostrar tooltip com o ID da geometria quando o mouse passar sobre a linha
var tooltip = L.tooltip({
direction: 'auto', // Leaflet determina a melhor posi<73><69>o
sticky: true // Faz com que o tooltip siga o cursor do mouse
})
.setContent('Rua ' + feature.id); // Define o conte<74>do do tooltip
// Abre o tooltip na posi<73><69>o atual do mouse
var latLng = e.latlng;
tooltip.setLatLng(latLng);
layer.bindTooltip(tooltip).openTooltip(latLng);
}*/
});
};
var geo_json_66b1efbb9a28b321c2fa400e06abb4dd = L.geoJson(null, {
onEachFeature: geo_json_66b1efbb9a28b321c2fa400e06abb4dd_onEachFeature,
});
function geo_json_66b1efbb9a28b321c2fa400e06abb4dd_add (data) {
geo_json_66b1efbb9a28b321c2fa400e06abb4dd
.addData(data);
}
geo_json_66b1efbb9a28b321c2fa400e06abb4dd_add({"features": [{"geometry": {"coordinates": [[-47.3952254055, -22.172533942], [-47.395225375833334, -22.172533945166666], [-47.39522536, -22.17253395033333], [-47.395225396, -22.172533917333332], [-47.39522538566667, -22.172533929166665], [-47.3952253625, -22.172533931], [-47.39522537333333, -22.172533913833334], [-47.3952254075, -22.172533932666667], [-47.3952254015, -22.1725339235], [-47.39522539083333, -22.172533871833334], [-47.39522538633334, -22.172533889833332], [-47.39522538883333, -22.172533938166666], [-47.39522532266667, -22.172533783166667], [-47.3952253755, -22.172533833833334], [-47.39522542266667, -22.172533886333333], [-47.395225376666666, -22.17253385], [-47.395225406, -22.172533918666666], [-47.39522536216667, -22.172533896666668], [-47.395225380166664, -22.172533882166668], [-47.3952253385, -22.172533917], [-47.395225338833335, -22.172533880833335], [-47.3952253715, -22.172534008], [-47.39522515416667, -22.17253585], [-47.395225682833335, -22.172538589833334], [-47.395225110666665, -22.1725415625], [-47.39522159216666, -22.172544007666666], [-47.39521984783333, -22.172545229166666], [-47.395216104666666, -22.172547636166666], [-47.395213543333334, -22.172549243], [-47.395209662333336, -22.172550401666665], [-47.395206343666665, -22.172551362166665], [-47.395201936666666, -22.172553026], [-47.395199110166665, -22.172553107666666], [-47.3951936935, -22.172554909333332], [-47.395189896333335, -22.1725553505], [-47.395185643666665, -22.172556707666665], [-47.39518255683333, -22.1725582955], [-47.395180292166664, -22.172561503333334], [-47.395179868666666, -22.1725624235], [-47.395179748333334, -22.172564968166668], [-47.3951803665, -22.172567016833334], [-47.395180151666665, -22.17256647516667], [-47.39518018816667, -22.172566437166665], [-47.3951802205, -22.1725664125], [-47.395180158, -22.17256636566667], [-47.39518042033333, -22.172566472], [-47.39518025783333, -22.172566445], [-47.39518023483333, -22.172566456666665], [-47.395180482, -22.172566810833334], [-47.39518077766667, -22.172567701], [-47.3951810195, -22.172568283833332], [-47.39518273633333, -22.172570346666667], [-47.39518391833333, -22.172571541666667], [-47.395185087, -22.172572474833334], [-47.395185625, -22.172572634333335], [-47.3951915445, -22.172574845333333], [-47.39519915233333, -22.1725738695], [-47.39520185516667, -22.172572538], [-47.3952026145, -22.172570537833334], [-47.39520321316667, -22.172569555333332], [-47.39520324483333, -22.172569608666667], [-47.395203652, -22.172569057], [-47.395205311, -22.172567083666667], [-47.39520654366667, -22.172566266666667], [-47.395209746, -22.172564657166667], [-47.395212001333334, -22.172564261333335], [-47.39521493183334, -22.172564769333334], [-47.3952180295, -22.172565956833335], [-47.395220261333336, -22.17256771816667], [-47.39522139416667, -22.172569923333334], [-47.39522310466667, -22.172572761833333], [-47.395222766833335, -22.172575681833333], [-47.395221691833335, -22.172579720333335], [-47.395219344333334, -22.172582631166666], [-47.39521598966667, -22.172585488], [-47.3952126065, -22.172588239], [-47.395208282333336, -22.172591637333333], [-47.395204749166666, -22.172593616833332], [-47.395202006666665, -22.172596476833334], [-47.395200796, -22.172599888666667], [-47.395200747666664, -22.172605109833334], [-47.39520230283333, -22.1726114345], [-47.39520447966667, -22.172618098], [-47.395206570166664, -22.1726243405], [-47.395208866666664, -22.172631373833333], [-47.39521058616667, -22.172636519166666], [-47.39521184083333, -22.172641677666668], [-47.395213362166665, -22.172647666833335], [-47.39521389283333, -22.172653059833333], [-47.3952151115, -22.172658690666665], [-47.395215728, -22.172664351], [-47.3952160925, -22.172671540166668], [-47.39521683433333, -22.17267969], [-47.39521793633333, -22.172686389166667], [-47.395218779333334, -22.172692869833334], [-47.3952195255, -22.17270061583333], [-47.39521956983333, -22.172703362666667], [-47.395220611333336, -22.172706160666667], [-47.39522113633333, -22.17270928783333], [-47.395221594166664, -22.172713167833333], [-47.39522206433333, -22.1727161435], [-47.3952219795, -22.172718427333333], [-47.395221535666664, -22.172720915333333], [-47.3952201495, -22.1727233415], [-47.395218424333336, -22.172724801333334], [-47.3952160225, -22.172726587666666], [-47.395213375833336, -22.172727455833332], [-47.39521017683333, -22.172727332333334], [-47.395206572333336, -22.172726499666666], [-47.3952044225, -22.172725207833334], [-47.395202150833335, -22.172723598166666], [-47.39520026933333, -22.172721495833333], [-47.3951994965, -22.17271890583333], [-47.395198475, -22.172716128166666], [-47.3951981605, -22.172712078333333], [-47.395197995833335, -22.172708643333333], [-47.395198191666665, -22.172705386333334], [-47.39519880966667, -22.172702324666666], [-47.39519927966667, -22.172699308], [-47.395199633833336, -22.172696251166666], [-47.3952000945, -22.17269221866667], [-47.395200077, -22.172687044833335], [-47.3951996805, -22.172679977166666], [-47.395198538, -22.172672327], [-47.395196792, -22.172665214833334], [-47.395195095333335, -22.172658601166667], [-47.3951933905, -22.172652162666665], [-47.395192307833334, -22.1726472645], [-47.39518980366667, -22.1726372565], [-47.395188753166664, -22.172631497666668], [-47.39518845933333, -22.172625668833334], [-47.39518835516667, -22.172619247166665], [-47.395188550166665, -22.172612288666667], [-47.3951879105, -22.172605531833334], [-47.39518720416667, -22.17259809933333], [-47.395186193, -22.172589186333333], [-47.39518532133334, -22.172581299666668], [-47.395183608, -22.172574488333332], [-47.395182355, -22.17257008], [-47.3951803425, -22.172566675833334], [-47.39517991183333, -22.17256398316667], [-47.39517956666667, -22.172561080166666], [-47.39517973433333, -22.1725581675], [-47.395180905833335, -22.172555103333334], [-47.3951815745, -22.17255269116667], [-47.395181984333334, -22.17255043], [-47.395181826666665, -22.1725479635], [-47.39518077033333, -22.172544941833333], [-47.395179391333336, -22.172543084166666], [-47.39517737, -22.172541474], [-47.395175143, -22.172540207166666], [-47.395173355, -22.172540031666667], [-47.39517027666667, -22.172539963666665], [-47.3951681515, -22.1725410975], [-47.395165865, -22.172543319833334], [-47.395163970333336, -22.172545611166665], [-47.395162965333334, -22.172548342], [-47.39516295083333, -22.1725519695], [-47.3951645125, -22.1725556805], [-47.3951660855, -22.1725590175], [-47.395168029333334, -22.172561242333334], [-47.395168696333336, -22.172563742], [-47.3951695605, -22.172567314666665], [-47.395170603333334, -22.17257025583333], [-47.395171313166664, -22.172573074], [-47.395172314166665, -22.172576464833334], [-47.395173078666666, -22.172580877333335], [-47.3951746255, -22.1725872715], [-47.395176579, -22.172593653666667], [-47.3951774355, -22.172600016333334], [-47.39517822716667, -22.1726020545], [-47.3951788455, -22.1726070365], [-47.395180321666665, -22.172628811166668], [-47.3951801885, -22.172638091333333], [-47.39517983416667, -22.172647245666667], [-47.39518084233333, -22.1726581625], [-47.3951816955, -22.1726627675], [-47.3951909275, -22.172680933333332], [-47.39519805133333, -22.172691808333333], [-47.3951974225, -22.172691086666667], [-47.39519779333333, -22.1726908165], [-47.395197776833335, -22.17269086416667], [-47.3952004085, -22.172693402833332], [-47.395201913166666, -22.172696285666667], [-47.39520233583333, -22.172698020333332], [-47.395202376, -22.172699805], [-47.395200665833336, -22.17270557066667], [-47.39519838983333, -22.172708087], [-47.395195257833336, -22.172710028], [-47.3951933045, -22.172712198], [-47.395191159166664, -22.1727142945], [-47.39518945383333, -22.172717288833333], [-47.39518861116667, -22.172720368166665], [-47.39518852, -22.1727231285], [-47.395188206166665, -22.172725744666668], [-47.395187154666665, -22.172727466166666], [-47.395185253166666, -22.172729890833335], [-47.3951831885, -22.17273108], [-47.39517948816667, -22.1727322765], [-47.395176768166664, -22.172732547], [-47.39517387283333, -22.172732082833335], [-47.3951719015, -22.1727314135], [-47.39516994016667, -22.172730022666666], [-47.395168332, -22.172728317166666], [-47.3951682275, -22.1727278615], [-47.395168231666666, -22.172727864166667], [-47.39516811883333, -22.172727503833332], [-47.3951668105, -22.172724076166666], [-47.3951667245, -22.172722158833334], [-47.39516696966667, -22.17272210366667], [-47.395167959, -22.172720036666668], [-47.3951689935, -22.17271727116667], [-47.395171544, -22.172715690333334], [-47.39517439083333, -22.172713620666666], [-47.3951761105, -22.172711158666665], [-47.395177430333334, -22.172708418833334], [-47.39517780283333, -22.172705468333334], [-47.395178105666666, -22.172702655666665], [-47.39517739, -22.1726997695], [-47.395174946, -22.172692977166665], [-47.395172190833335, -22.172686950333333], [-47.395169134166665, -22.172681460833335], [-47.395168218, -22.172676303], [-47.395166813833335, -22.172671291], [-47.39516545516667, -22.172665821666666], [-47.395163927, -22.172660165666667], [-47.395163035, -22.172653888333333], [-47.39516243333333, -22.172646402], [-47.395161572, -22.172640130666668], [-47.395161336166666, -22.172633127666668], [-47.395160803, -22.172625776166665], [-47.395159635, -22.1726179595], [-47.395158197, -22.172610746], [-47.3951574545, -22.172604221666667], [-47.39515602416667, -22.172596246333335], [-47.39515492583333, -22.1725902725], [-47.395154095, -22.172585331666667], [-47.39515347366667, -22.172581365333333], [-47.395153392333334, -22.172579820166668], [-47.395152999833336, -22.172578276333333], [-47.3951514125, -22.172575650166667], [-47.395150849333334, -22.17257388433333], [-47.39515011816667, -22.172570046166665], [-47.39514987016667, -22.172566999666667], [-47.39514948833333, -22.172562808], [-47.3951489675, -22.172559710166666], [-47.3951494275, -22.172556416166668], [-47.3951498975, -22.172555171166668], [-47.395149685, -22.172551588166666], [-47.39514967616667, -22.172549613], [-47.3951498475, -22.172548205666665], [-47.3951520385, -22.172544735166667], [-47.395153477166666, -22.172542650166665], [-47.395155711166666, -22.172541104166665], [-47.3951567435, -22.172540765833332], [-47.39516041466667, -22.172539532666665], [-47.395162809333335, -22.17253920983333], [-47.395167772166666, -22.172540326333333], [-47.39516861133333, -22.172541383166667]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": "1", "Length": 102.92127943537264, "Name": "20_03_2025_13_23_34"}, "type": "Feature"}], "type": "FeatureCollection"});
geo_json_66b1efbb9a28b321c2fa400e06abb4dd.addTo(map_3e3ecf608b53aa6268b796f9f5e08542);
</script>
<script>
function trajeto_json_onEachFeature(feature, layer) {
layer.on({
});
};
var trajeto_json = L.geoJson(null, {
onEachFeature: trajeto_json_onEachFeature,
style: function(feature) {
return {color: 'red'};
}
}
);
function trajeto_json_add (data) {
trajeto_json.addData(data);
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_3e3ecf608b53aa6268b796f9f5e08542);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
}
function saoCoordenadasIguais(coord1, coord2, tolerancia) {
return Math.abs(coord1[0] - coord2[0]) < tolerancia && Math.abs(coord1[1] - coord2[1]) < tolerancia;
}
function adicionarCoordenada(idGeometria, novaCoordenada) {
var feature = trajeto_json.toGeoJSON().features.find(f => f.id === idGeometria);
if (feature) {
var ultima = [0.0,0.0];
if (feature.geometry.coordinates.length > 0) {
ultima = feature.geometry.coordinates[feature.geometry.coordinates.length - 1];
}
if (!saoCoordenadasIguais(ultima, novaCoordenada, 0.000001)) {
feature.geometry.coordinates.push(novaCoordenada);
var ft = feature;
trajeto_json.clearLayers();
trajeto_json.addData(ft);
}
} else {
console.log("Feature com ID " + idGeometria + " n<>o encontrada.");
}
}
adicionarGeometria({
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": []
},
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": 1517, "Length": 21.724783283, "Name": "Projeto"},
"id": "Tj"
});
</script>
<script>
function trajeto_dinamico_json_onEachFeature(feature, layer) {
layer.on({
});
};
var trajeto_dinamico_json = L.geoJson(null, {
onEachFeature: trajeto_dinamico_json_onEachFeature,
style: function(feature) {
return {color: 'green'};
}
}
);
function trajeto_dinamico_json_add (data) {
trajeto_dinamico_json.addData(data);
}
trajeto_dinamico_json_add({"features": []});
trajeto_dinamico_json.addTo(map_3e3ecf608b53aa6268b796f9f5e08542);
function adicionarGeometriaDinamica(novaGeometria) {
trajeto_dinamico_json.addData(novaGeometria);
}
function adicionarCoordenadaDinamica(idGeometria, coordenadas) {
var feature = trajeto_dinamico_json.toGeoJSON().features.find(f => f.id === idGeometria);
if (feature) {
feature.geometry.coordinates = [];
coordenadas.forEach(x => feature.geometry.coordinates.push([x.longitude, x.latitude]));
var ft = feature;
trajeto_dinamico_json.clearLayers();
trajeto_dinamico_json.addData(ft);
} else {
console.log("Feature com ID " + idGeometria + " nao encontrada.");
}
}
adicionarGeometriaDinamica({
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": []
},
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": 1517, "Length": 21.724783283, "Name": "Projeto"},
"id": "TjD"
});
</script>
<script src="folium/mqtt.min.js"></script>
<script src="folium/leaflet.rotatedMarker.js"></script>
<script>
let posicaoAtualEquipamento = {
lat: 0,
long: 0
};
let posicaoAtualBase = {
lat: 0,
long: 0
};
var customIcon = L.icon({
iconUrl: 'folium/images/position_marker.png',
iconSize: [32, 32],
iconAnchor: [16, 16],
popupAnchor: [0, -16]
});
var marcadorEquipamento = L.marker([0, 0], {
icon: customIcon
}).addTo(map_3e3ecf608b53aa6268b796f9f5e08542);
var marcadorBase = L.marker([0, 0], {}).addTo(map_3e3ecf608b53aa6268b796f9f5e08542);
var icon = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
);
marcadorBase.setIcon(icon);
// Conectar ao broker MQTT
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conex<65>o segura
// Quando conectado, inscreva-se no t<>pico desejado
client.on('connect', function () {
console.log('Conectado ao broker MQTT');
// Inscrever-se no t<>pico
client.subscribe('coordenadas_gps', function (err) {
if (!err) {
console.log("Inscricao bem-sucedida no topico");
} else {
console.error("Falha na inscricao do topico", err);
}
});
client.subscribe('trajetoria_dinamica', function (err) {
if (!err) {
console.log("Inscricao bem-sucedida no topico");
} else {
console.error("Falha na inscricao do topico", err);
}
});
client.subscribe('selecao_ruas_mapa', function (err) {
if (!err) {
console.log("Inscricao bem-sucedida no topico");
} else {
console.error("Falha na inscricao do topico", err);
}
});
});
// Lidar com mensagens recebidas para o topico inscrito
client.on('message', function (topic, message) {
var dados = JSON.parse(message);
if (topic === "trajetoria_dinamica") {
adicionarCoordenadaDinamica("TjD", dados); // "Tj" <20> o ID da feature no GeoJSON
}
else if (topic === "coordenadas_gps") {
// A mensagem e um Buffer, converta para string ou objeto conforme necessario
//console.log(`Mensagem recebida no topico '${topic}': ${message.toString()}`);
var id = dados.id;
var novaLatitude = dados.latitude;
var novaLongitude = dados.longitude;
var novaPosicao = [novaLatitude, novaLongitude];
var orientacao = dados.orientacao;
var foco = dados.foco;
if (id == 1) {
marcadorBase.setLatLng(novaPosicao);
// Calcular angulo de rotacao
var angulo = dados.orientacao;
posicaoAtualBase.lat = novaPosicao[0];
posicaoAtualBase.long = novaPosicao[1];
// Rotacionar o marcador para o angulo calculado
marcadorBase.setRotationAngle(angulo);
}
else {
marcadorEquipamento.setLatLng(novaPosicao);
// Calcular angulo de rotacao
var angulo = dados.orientacao;
posicaoAtualEquipamento.lat = novaPosicao[0];
posicaoAtualEquipamento.long = novaPosicao[1];
// Rotacionar o marcador para o angulo calculado
marcadorEquipamento.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
}
if (foco) {
map_3e3ecf608b53aa6268b796f9f5e08542.setView(novaPosicao, map_3e3ecf608b53aa6268b796f9f5e08542.getZoom());
}
}
else if (topic === 'selecao_ruas_mapa') {
var selecionadas = dados;
if (selecionadas.length != RuasSelecionadas.length) {
atualizarSelecaoRuas(selecionadas);
}
}
});
// Fun<75><6E>o para atualizar a sele<6C><65>o das ruas e mudar a cor no mapa
function atualizarSelecaoRuas(selecionadas) {
selecionadas = JSON.parse(selecionadas);
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
geo_json_66b1efbb9a28b321c2fa400e06abb4dd.eachLayer(function (layer) {
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
layer.setStyle({ color: 'blue' });
} else {
layer.setStyle({ color: '#3388ff' }); // Cor original
}
});
}
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
// Converter latitudes e longitudes de graus para radianos
const latA = P1latitude * (Math.PI / 180.0);
const lonA = P1longitude * (Math.PI / 180.0);
const latB = P2latitude * (Math.PI / 180.0);
const lonB = P2longitude * (Math.PI / 180.0);
// Calcular a diferen<65>a de longitude
const deltaLon = lonB - lonA;
// Calcular a dire<72><65>o
const y = Math.sin(deltaLon) * Math.cos(latB);
const x = Math.cos(latA) * Math.sin(latB) - Math.sin(latA) * Math.cos(latB) * Math.cos(deltaLon);
const direcaoRadianos = Math.atan2(y, x);
// Converter a dire<72><65>o de radianos para graus
let direcaoGraus = direcaoRadianos * (180.0 / Math.PI);
// Normalizar a dire<72><65>o para que esteja no intervalo de 0 a 360 graus
direcaoGraus = (direcaoGraus + 360) % 360;
return direcaoGraus;
}
</script>
</html>