Skip to content

Commit

Permalink
geosolutions-it#8723 Fix for WMTS background issues due to `attributi…
Browse files Browse the repository at this point in the history
…on` parameter; geosolutions-it#8724 WMTS request identify flow fixes
alex-fko committed Oct 24, 2022

Verified

This commit was signed with the committer’s verified signature.
AgeManning Age Manning
1 parent 99132d4 commit 13e32ec
Showing 3 changed files with 31 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import PropertiesViewer from './PropertiesViewer';
import { getRowViewer } from '../../../../../utils/MapInfoUtils';
import { ANNOTATIONS } from '../../../../../utils/AnnotationsUtils';
import PropTypes from 'prop-types';
import {omit} from "lodash/object";

const defaultRowViewerOptions = {
// we need some default options for annotations
@@ -41,7 +42,7 @@ function RowViewer({
const Row = layerRowViewer || component || PropertiesViewer;
return (
<Row
{...feature.properties}
{...omit(feature.properties, ['ref'])}
feature={feature}
labelIds={labelIds}
exclude={excludeProperties}
5 changes: 3 additions & 2 deletions web/client/utils/leaflet/WMTS.js
Original file line number Diff line number Diff line change
@@ -42,8 +42,9 @@ var WMTS = L.TileLayer.extend({
wmtsParams.width = wmtsParams.height = tileSize;
}
for (let i in options) {
// all keys that are not TileLayer options go to WMS params
if (!this.options.hasOwnProperty(i) && i !== 'crs') {
// all keys that are not TileLayer options go to WMTS params
// skip attribution parameter, html content of it make requests fail
if (!this.options.hasOwnProperty(i) && i !== 'crs' && i !== 'attribution') {
wmtsParams[i] = options[i];
}
}
28 changes: 26 additions & 2 deletions web/client/utils/mapinfo/wmts.js
Original file line number Diff line number Diff line change
@@ -17,9 +17,13 @@ import {
import {getLayerUrl} from '../LayersUtils';
import {optionsToVendorParams} from '../VendorParamsUtils';

import {isObject, isNil} from 'lodash';
import {isObject, isNil, get} from 'lodash';

import assign from 'object-assign';
import Rx, {Observable} from "rxjs";
import axios from "../../libs/ajax";
import {parseString} from "xml2js";
import {stripPrefix} from "xml2js/lib/processors";

export default {
buildRequest: (layer, props) => {
@@ -78,5 +82,25 @@ export default {
},
url: getLayerUrl(layer).replace(/[?].*$/g, '')
};
}
},
getIdentifyFlow: (layer, basePath, params) =>
Observable.defer(() => axios.get(basePath, { params }))
.catch((e) => {
if (e.data.indexOf("ExceptionReport") > 0) {
return Rx.Observable.bindNodeCallback( (data, callback) => parseString(data, {
tagNameProcessors: [stripPrefix],
explicitArray: false,
mergeAttrs: true
}, callback))(e.data).map(data => {
const code = get(data, "ExceptionReport.Exception.exceptionCode");
if (code === 'TileOutOfRange') {
return { data: { features: []}};
}
return e;
});

}
return e;
})

};

0 comments on commit 13e32ec

Please sign in to comment.