Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the non WFS OGC server query, and the alias #4161

Merged
merged 1 commit into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion contribs/gmf/src/datasource/WFSAliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ const exports = class {
*/
describe(dataSource) {
// Only QGIS Server supports WFS aliases
if (dataSource.ogcServerType === 'qgisserver' && !dataSource.attributes) {
if (dataSource.ogcServerType === 'qgisserver' &&
dataSource.wfsUrl_ &&
dataSource.getOGCLayerNames().length == 1 &&
!dataSource.attributes) {
// Trigger an additional WFS DescribeFeatureType request to get
// datasource attributes, including aliases.
this.ngeoDataSourcesHelper_.getDataSourceAttributes(dataSource);
Expand Down
23 changes: 12 additions & 11 deletions src/datasource/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,21 @@ const exports = class {
// We know, at this point, that there's only one definition that
// was returned. Just to be sure, let's do a bunch of assertions.
const ogcLayerName = dataSource.getOGCLayerNames()[0];
googAsserts.assertString(
ogcLayerName, 'The data source should have only one ogcLayer.');
const element = featureType.element[0];
googAsserts.assert(element.name === ogcLayerName);
googAsserts.assert(
featureType.complexType[0].name === element.type);
googAsserts.assertString(ogcLayerName, 'The data source should have only one ogcLayer.');
for (const element of featureType.element) {
if (element.name === ogcLayerName) {
googAsserts.assert(featureType.complexType[0].name === element.type);

const complexContent = featureType['complexType'][0]['complexContent'];
const attributes = new ngeoFormatWFSAttribute().read(complexContent);
const complexContent = featureType.complexType[0].complexContent;
const attributes = new ngeoFormatWFSAttribute().read(complexContent);

// Set the attributes in the data source
dataSource.setAttributes(attributes);
// Set the attributes in the data source
dataSource.setAttributes(attributes);

wfsDescribeFeatureTypeDefer.resolve(attributes);
wfsDescribeFeatureTypeDefer.resolve(attributes);
break;
}
}
});
}

Expand Down