Reverting To Check Compatibility

This commit is contained in:
2020-12-30 16:35:15 -05:00
parent ca32fe6115
commit 9296d60222
2 changed files with 3 additions and 18 deletions
+1 -2
View File
@@ -2,11 +2,10 @@ var baseurl = "https://avwx.rest/api/"
function nearestStations(x, y) {
FetchPending = $.ajax({
url: baseurl + 'metar/' + y + ',' + x + '?options=info&format=json',
url: baseurl + 'metar/' + x + ',' + y + '?token=' + AVWX + '&options=info&format=json',
timeout: 5000,
cache: false,
dataType: 'json',
headers: { 'Authorization': AVWX }
});
FetchPending.done(function(data) {
document.getElementById('metar_loading').style.display = "none"
+2 -16
View File
@@ -495,23 +495,9 @@ function initialize_map() {
// Listeners for newly created Map
OLMap.on("moveend", function() {
var center = ol.proj.toLonLat(OLMap.getView().getCenter(), OLMap.getView().getProjection());
if (TAB === 'METAR') {
var center = OLMap.getView().getCenter()
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://cors-anywhere.herokuapp.com/epsg.io/trans?x=" + center[0] + "&y=" + center[1] + "&s_srs=3857&t_srs=4326", true);
xhr.setRequestHeader('Content-Type', 'application/json', "mode", "cors");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
console.log(xhr.response)
var output = xhr.response
var coordinates = JSON.parse(output)
var long = parseFloat(coordinates.x).toFixed(2)
var lat = parseFloat(coordinates.y).toFixed(2)
nearestStations(long, lat)
}
}
xhr.send()
nearestStations(center[1], center[0])
}
})