You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've updated my windshaft install from 1.6.1 to 2.5.0 and have run into a problem with overriding a layer's styling via a req2params function.
With 1.6.1 I was able to add a new style key:value to req.params and have the layer rendered with that new style. With the upgrade I am no longer able to do that in the same way.
Currently I am extending the incoming request like so:
With 1.6.1 I am seeing the new style but with 2.5.0 I am still seeing the original style that I initialized the layer with. After some digging I think I may have found the cause, however, I am not sure if it is intentional and I just am not changing the style the proper way anymore.
At line 179 in the mapnik render factory the params are created using the defaults of mmlBuilderConfig and options.params. The issue seems to be that since the original mapConfig always contains the style param that any new style is ignored for the default. Switching var params = _.defaults(mmlBuilderConfig, options.params); to var params = _.defaults(options.params, mmlBuilderConfig); seems to correct this issue. This same issue would be relevant with any new sql passed during the req2params.
Thanks for all of the great work.
Edit: Noticed a newer version (2.6.2) on npm. Installed that and still have the same issue/fix.
The text was updated successfully, but these errors were encountered:
Hello,
I've updated my windshaft install from 1.6.1 to 2.5.0 and have run into a problem with overriding a layer's styling via a req2params function.
With 1.6.1 I was able to add a new style key:value to req.params and have the layer rendered with that new style. With the upgrade I am no longer able to do that in the same way.
Currently I am extending the incoming request like so:
With 1.6.1 I am seeing the new style but with 2.5.0 I am still seeing the original style that I initialized the layer with. After some digging I think I may have found the cause, however, I am not sure if it is intentional and I just am not changing the style the proper way anymore.
At line 179 in the mapnik render factory the params are created using the defaults of mmlBuilderConfig and options.params. The issue seems to be that since the original mapConfig always contains the style param that any new style is ignored for the default. Switching
var params = _.defaults(mmlBuilderConfig, options.params);
tovar params = _.defaults(options.params, mmlBuilderConfig);
seems to correct this issue. This same issue would be relevant with any new sql passed during the req2params.Thanks for all of the great work.
Edit: Noticed a newer version (2.6.2) on npm. Installed that and still have the same issue/fix.
The text was updated successfully, but these errors were encountered: