Add new functionality for dzialki, dzialki2, lines, mpzp, osuwiska, position, section, and test modules with API integration and canvas drawing capabilities

This commit is contained in:
2025-06-05 11:33:33 +02:00
parent 1c97e0610f
commit eb69a810fd
8 changed files with 556 additions and 0 deletions

48
js/functions/dzialki2.js Normal file
View File

@@ -0,0 +1,48 @@
let dzialki2Icon = document.createElement("img");
function dzialki2ButtonClick() {
dzialki2Button.style.background = "gray";
dzialki2Icon.src = chrome.runtime.getURL("icons/loading.gif");
const canvas = document.getElementsByClassName("ol-unselectable")[0];
const ctx = canvas.getContext("2d");
const height = canvas.height;
const width = canvas.width;
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=3857`;
fetch(URL, {
method: "GET",
})
.then((response) => response.json())
.then((data) => {
let NXMIN = data[0].x;
let NYMIN = data[0].y;
let NXMAX = data[1].x;
let NYMAX = data[1].y;
var img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0, width, height);
dzialki2Icon.src = chrome.runtime.getURL("icons/dzialki2.png");
};
img.onerror = function () {
dzialki2Icon.src = chrome.runtime.getURL("icons/dzialki2.png");
dzialki2Button.style.background = "pink";
}
img.src = `https://geoserver.lp-portal.pl/geoserver/pzdnowysacz/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=TRUE&LAYERS=dzialki&env=historydate%3A3022-11-28%2014%3A13%3A48&SRS=EPSG%3A3857&STYLES=&WIDTH=${width}&HEIGHT=${height}&BBOX=${NXMIN}%2C${NYMIN}%2C${NXMAX}%2C${NYMAX}`;
// img.src = `
// https://integracja01.gugik.gov.pl/cgi-bin/KrajowaIntegracjaEwidencjiGruntow?VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=dzialki,numery_dzialek,budynki&SRS=EPSG:2180&WIDTH=${width}&HEIGHT=${height}&TRANSPARENT=TRUE&FORMAT=image/png&BBOX=${NXMIN},${NYMIN},${NXMAX},${NYMAX}
// `;
dzialki2Button.style.background = "none";
});
}