miguelcobain/ember-leaflet

Adding custom options to Wms-Tile?

jenskofodhansen opened this issue · 3 comments

Hi

We used to pass a custom token to the WMS server through the options parameter in version 4.1. Now we are trying to upgrade our packages, and it seems this is no longer possible in EmberLeaflet v. 5.1? We used to have:
{{layers.wms-tile url=ortoMapUrl options=ortoLayerOptions}}. but now it seems each parameter needs to be send separately. And custom options are not send to the WMS server, but ignored.

Indeed, that was possible to do, but was undocumented behavior.

There is a problem with passing all the options: you would be losing reactivity.
Let me explain.
with the following

<layers.wms-tile-layer @url={{ortoMapUrl}} @opacity={{ortoOpacity}} />

if ortoOpacity changes, then ember-leaflet knows that it has to call setOpacity on the layer with the new opacity.

If you do

<layers.wms-tile-layer @url={{ortoMapUrl}} @options={{ortoLayerOptions}} />

where ortoLayerOptions is { opacity: 50 }, if ortoLayerOptions changes, there's no way for ember-leaflet to know that.

In your case, I think the easiest would be to explicitly migrate to passing the options explicitly.

For example, from this:

<layers.wms-tile-layer @url={{ortoMapUrl}} @options={{ortoLayerOptions}} />

to this:

<layers.wms-tile-layer
  @url={{ortoMapUrl}}
  @layers={{ortoLayerOptions.layers}}
  @format={{ortoLayerOptions.format}}
  @version={{ortoLayerOptions.version}} />

Is that a possible migration for you and does it solve your issue?

Thank you very much for your reply. The issue was that we had an additional ticket variable in the options, which would be added to the URL in version 4.1. (options.ticket would become ?ticket=...... in the final request URL). Now I have simply added the ticket parameter explicitly to the base url. This works and I guess is an ok solution.

Can you tell me, if the zoom parameter works differently between 4.1 and 5.1? I get a map which is much more zoomed out?