Skip to content

Commit

Permalink
fix(wfs-filter): Dont query DescribeFeatureType multiple time for the…
Browse files Browse the repository at this point in the history
… same layer

Fixes missing attribute names on layer toggle as well
  • Loading branch information
FilipLeitner authored and jmacura committed Oct 3, 2024
1 parent 7dfe36a commit a072db7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion projects/hslayers/components/wfs-filter/wfs-filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export class HsWfsFilterComponent extends HsPanelBaseComponent {
*/
async selectLayer(layer: HsLayerDescriptor | null) {
this.selectedLayer.set(layer);
if (!layer) {

if (!layer || this.setExistingLayerAttributes(layer)) {
return;
}

Expand Down Expand Up @@ -155,6 +156,18 @@ export class HsWfsFilterComponent extends HsPanelBaseComponent {
this.hsFiltersService.setSelectedLayer(layer);
}

/**
* Sets the existing layer attributes and returns true if successful, false otherwise
*/
private setExistingLayerAttributes(layer: HsLayerDescriptor): boolean {
const layerAttributes = getWfsAttributes(layer.layer);
if (layerAttributes) {
this.hsFiltersService.setLayerAttributes(layerAttributes);
return true;
}
return false;
}

/**
* Parses the WFS DescribeFeatureType response XML into an array of feature attributes.
* @param xmlString The XML string response from the WFS DescribeFeatureType request.
Expand Down

0 comments on commit a072db7

Please sign in to comment.