Skip to content

Commit

Permalink
Update getfeatureinfo.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jokd committed Dec 14, 2024
1 parent 8d9ee8e commit 834583b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/getfeatureinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,18 @@ async function getFeatureInfoUrl({
const format = layer.get('infoFormat');
const formatArr = [...new Set([format, 'application/geo+json', 'application/geojson', 'application/json'])];
let text;
for (const f of formatArr) {
for (let i = 0; i < formatArr.length; i += 1) {
const format = formatArr[i];

Check failure on line 150 in src/getfeatureinfo.js

View workflow job for this annotation

GitHub Actions / lint

'format' is already declared in the upper scope on line 146 column 11
const url = layer.getSource().getFeatureInfoUrl(coordinate, resolution, projection, {
INFO_FORMAT: f,
INFO_FORMAT: format,
FEATURE_COUNT: '20'
});
const res = await fetch(url, { method: 'GET' });
text = await res.text();
if (isValidJSON(text)) {
layer.set('infoFormat', f);
// eslint-disable-next-line no-await-in-loop
const result = await fetch(url, { method: 'GET' }).then((res) => res.text())
.catch(error => console.error(error));

Check failure on line 157 in src/getfeatureinfo.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 8 spaces but found 6
if (isValidJSON(result)) {
text = result;
layer.set('infoFormat', format);
break;
}
}
Expand Down

0 comments on commit 834583b

Please sign in to comment.