23 lines
890 B
JavaScript
23 lines
890 B
JavaScript
function getGmina(width, height, XMIN, YMIN, XMAX, YMAX) {
|
|
const URL = `https://integracja.gugik.gov.pl/cgi-bin/KrajowaIntegracjaEwidencjiGruntow?VERSION=1.1.1&SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=dzialki,numery_dzialek,budynki&QUERY_LAYERS=dzialki,numery_dzialek,budynki&SRS=EPSG:2180&WIDTH=${width}&HEIGHT=${height}&TRANSPARENT=TRUE&FORMAT=image/png&BBOX=${XMIN},${YMIN},${XMAX},${YMAX}`;
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
fetch(URL, {
|
|
method: "GET",
|
|
})
|
|
.then((response) => response.text())
|
|
.then((str) => new window.DOMParser().parseFromString(str, "text/xml"))
|
|
.then((data) => {
|
|
console.log(data);
|
|
for (let attr of data.getElementsByTagName("Attribute")) {
|
|
if (attr.getAttribute("Name") == "Gmina") {
|
|
console.log(attr.innerHTML);
|
|
let dooda = attr.innerHTML;
|
|
resolve(dooda);
|
|
}
|
|
}
|
|
resolve(0);
|
|
});
|
|
});
|
|
}
|