Skip to content

Commit

Permalink
fix(query): catch GML3 error
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed May 29, 2020
1 parent 9a63ecd commit 4c9c4fe
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/geo/src/lib/query/shared/query.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ export class QueryService {
}

private createGeometryFromUrlClick(url) {

const searchParams: any = this.getQueryParams(url.toLowerCase());
const bboxRaw = searchParams.bbox;
const width = parseInt(searchParams.width, 10);
Expand Down Expand Up @@ -373,8 +372,8 @@ export class QueryService {
const f = tenPercentWidthGeom.getGeometry() as any;

const newGeom = {
type: f.getType(),
coordinates: f.getCoordinates()
type: f.getType(),
coordinates: f.getCoordinates()
};

return newGeom;
Expand Down Expand Up @@ -402,7 +401,12 @@ export class QueryService {

private extractGML3Data(res, zIndex, allowedFieldsAndAlias?) {
const parser = new olFormatGML3();
const features = parser.readFeatures(res);
let features = [];
try {
features = parser.readFeatures(res);
} catch (e) {
console.warn('query.service: GML3 is not well supported');
}
return features.map(feature =>
this.featureToResult(feature, zIndex, allowedFieldsAndAlias)
);
Expand Down Expand Up @@ -436,7 +440,6 @@ export class QueryService {
url,
imposedGeometry?
) {

const searchParams: any = this.getQueryParams(url.toLowerCase());
const projection = searchParams.crs || searchParams.srs || 'EPSG:3857';
const geomToAdd = this.createGeometryFromUrlClick(url);
Expand Down

0 comments on commit 4c9c4fe

Please sign in to comment.