function googleButtonClick() { googleButton.style.background = "gray"; let XMIN = Number(MapData.X_MIN); let YMIN = Number(MapData.Y_MIN); let XMAX = Number(MapData.X_MAX); let YMAX = Number(MapData.Y_MAX); let X = Math.abs((XMAX - XMIN) / 2); let Y = Math.abs((YMAX - YMIN) / 2); // let URL = `https://epsg.io/trans?data=${XMIN + X},${ // YMIN + Y // }&s_srs=2177&t_srs=4326`; stary endpoint let URL = `https://api.maptiler.com/coordinates/transform/${XMIN + X},${ YMIN + Y }.json?s_srs=2177&t_srs=4326&key=OZa2pWHGvC94xakI0fVk`; fetch(URL, { method: "GET", }) .then((response) => response.json()) .then((data) => { console.log(data); let NX = data.results[0].x; let NY = data.results[0].y; let newURL = `https://www.google.pl/maps/@${NY},${NX},18z/data=!3m1!1e3`; window.open(newURL, "_blank"); googleButton.style.background = "none"; }); }