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

Fixed unexpected GetMap responses from remote WMS #872

Merged
merged 1 commit into from
Jul 6, 2018

Conversation

lgoltz
Copy link
Contributor

@lgoltz lgoltz commented Nov 30, 2017

Configuring the WMS [1] as a remote service leads to unexpected (empty) GetMap responses. in the theme configuration the layers are merged into one Theme:

    <Theme>
      <Identifier>ALK</Identifier>
      <d:Title>ALK (B1 - B6)</d:Title>
      <Layer>adv_alkis_tatsaechliche_nutzung</Layer>
      <Layer>adv_alkis_gewaesser</Layer>
      <Layer>adv_alkis_vegetation</Layer>
      <Layer>adv_alkis_verkehr</Layer>
      <Layer>adv_alkis_siedlung</Layer>
      <Layer>adv_alkis_gesetzl_festlegungen</Layer>
      <Layer>adv_alkis_bodensch</Layer>
      <Layer>adv_alkis_oeff_rechtl_sonst_festl</Layer>
      <Layer>adv_alkis_weiteres</Layer>
      <Layer>adv_alkis_bauw_einricht</Layer>
      <Layer>adv_alkis_gebaeude</Layer>
      <Layer>adv_alkis_flurstuecke</Layer>
    </Theme>

The service contains layers

  1. with three style "Farbe", "Gelb" and "Grau" (e.g. "adv_alkis_gebaeude") and
  2. with the same styles but inherited by the parent layer (e.g "adv_alkis_gewaesser").

Requesting the layer ALK with style default leads to

  1. not requested layers in case with the three styles
  2. the expected results in case of the layers with inherited styles

The reason for this is the following method:

@Override
public boolean isStyleApplicable( StyleRef style ) {
Map<String, Style> styles = metadata.getStyles();
if ( styles.isEmpty() && "default".equals( style.getName() ) ) {
return true;
}
return resolveStyleRef( style ) != null;
}

In case 2. (no styles are available cause the inheritance is not considered) this results in true, in case 1. to false.

This fix overwrites the method isStyleApplicable in RemoteWMSLayer to return true in case the default layer is requested. This makes the handling of a default style mandatory for the remote WMS layer. This should be ok as described in WMS 1.3.0 spec:

If the server advertises several styles for a layer, and the client sends a request for the default style, the choice of which style to use as default is at the discretion of the server. The ordering of styles in the service metadata does not indicate which is the default.

[1] www.wms.nrw.de/geobasis/wms_nw_alkis?service=WMS&request=GetCapabilities

…fault style even if the remote wms layer does not provide a layer with name default
@lgoltz lgoltz changed the title #115 - override isStyleApplicable in RemoteWMSLayer to pass default s… Fixed unexpected GetMap responses from remote WMS Nov 30, 2017
@tfr42 tfr42 added this to the 3.4 milestone Dec 1, 2017
@tfr42 tfr42 added bug error issue and bug (fix) WMS deegree Web Map Service labels Dec 1, 2017
@tfr42 tfr42 modified the milestones: 3.4, 3.4.1 Apr 6, 2018
@tfr42 tfr42 modified the milestones: 3.4.1, 3.4.2 Jun 18, 2018
@copierrj copierrj merged commit 109e881 into deegree:master Jul 6, 2018
@lgoltz lgoltz deleted the remoteWMsLayerDefaultStyle-115 branch December 8, 2022 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug error issue and bug (fix) WMS deegree Web Map Service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants