25 lines
1.9 KiB
JavaScript
25 lines
1.9 KiB
JavaScript
function sopoButtonClick() {
|
|
sopoButton.style.background = "gray";
|
|
let XMIN = MapData.X_MIN;
|
|
let YMIN = MapData.Y_MIN;
|
|
let XMAX = MapData.X_MAX;
|
|
let YMAX = MapData.Y_MAX;
|
|
|
|
// let URL = `https://epsg.io/trans?data=${XMIN},${YMIN};${XMAX},${YMAX}&s_srs=2177&t_srs=2180`; stary endpoint
|
|
let URL = `https://api.maptiler.com/coordinates/transform/${XMIN},${YMIN};${XMAX},${YMAX}.json?s_srs=2177&t_srs=2180&key=OZa2pWHGvC94xakI0fVk`;
|
|
|
|
fetch(URL, {
|
|
method: "GET",
|
|
})
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
let NXMIN = data.results[0].x;
|
|
let NYMIN = data.results[0].y;
|
|
let NXMAX = data.results[1].x;
|
|
let NYMAX = data.results[1].y;
|
|
let newURL = `https://geologia.pgi.gov.pl/geozagrozenia/?extent=${NXMIN}%2C${NYMIN}%2C${NXMAX}%2C${NYMAX}%2C2180&showLayers=mapy_seryjne_pig_5929_0%3Bmogilniki_6425%3Bmogilniki_6425_0%3Bantropopresja_8897%3Bantropopresja_8897_0%3Bantropopresja_8897_1%3Bantropopresja_8897_2%3Bantropopresja_8897_3%3Bantropopresja_8897_4%3Bantropopresja_8897_5%3Bantropopresja_8897_6%3Bantropopresja_8897_7%3Bantropopresja_8897_8%3Bantropopresja_8897_9%3Bantropopresja_8897_10%3Bantropopresja_8897_11%3Bantropopresja_8897_12%3Bantropopresja_8897_13%3Bantropopresja_8897_14%3Bantropopresja_8897_15%3Bantropopresja_8897_16%3Bantropopresja_8897_17%3Bantropopresja_8897_18%3Bantropopresja_8897_19%3Bwms_7574_1%3Bwms_1981_1%3Bwms_6578_1%3Bwms_3593_3%3Bwms_3593_2%3Bwms_3593_1%3Bwms_3593_0%3Bpodtopienia_5097%3Bpodtopienia_5097_0%3Bsopo_obszary_8417%3Bsopo_obszary_8417_0%3Bsopo_obszary_8417_1%3Bsopo_obszary_8417_2%3Bsopo_obszary_8417_3%3Bsopo_stan_8612_0%3Bkonflikty_srodowisko_2834_0%3Bkonflikty_srodowisko_2834_1%3Bkonflikty_srodowisko_2834_2%3Bkonflikty_srodowisko_2834_3%3Bwms_1142_numery_dzialek%3Bwms_1142_geoportal%3Bwms_1142_dzialki%3Bprg_9244%3Bprg_9244_2%3Bprg_9244_3%3BWMTS_9451%3BWMTS_2524`
|
|
window.open(newURL, "_blank");
|
|
sopoButton.style.background = "none";
|
|
});
|
|
}
|