Open geographika opened 4 years ago
@geographika thanks for creating this issue.
In geoStylerFilterToOlParserFilter throw an error if a clustered feature is passed. Check with t.get('features') or check the source for ol.source.Cluster?
Personally, I would rather refer from that, as this logic should be handled by users of the parser. The purpose of the parser is to provide a style object/function, the handling of when to apply such a style is not part of that.
@KaiVolland what do you think about that?
A single file debug build would be very useful for many situations when developing.
When developing/debugging we usually use our local react builds instead of the browser build. But I agree, for users that are not directly developing the parser and just want to see why something is not working as expected, having a debug browser build can be useful.
Would you be willing to provide a PR for that? This would mainly require an additional config file that extends browser-build.config.js and a corresponding build script in package.json.
I would prefer having a possibility to style clustered features instead. It's almost possible even right now if we provide
filter: ["!=", "features", "[object Object]"]
for the rule and use TextSymbolizer with {{features}} template.
The missing thing seems to be a way how to pass valueAdjust
function to
OlStyleUtil.resolveAttributeTemplate = function (feature, template, noValueFoundText, valueAdjust) {
.
Its never set anywhere or maybe I'm missing something.
Feature Request
Add a warning or throw an error if an OL feature is clustered when trying to apply a filter similar to below.
Is your feature request related to a problem? Please describe.
Spent several hours trying to work out why a style wasn't being applied to features before realising the layer had clustering. The features weren't displayed at all, rather than a default or non-style.
Describe the solution you'd like
In geoStylerFilterToOlParserFilter throw an error if a clustered feature is passed.
Check with
t.get('features')
or check the source forol.source.Cluster
?Describe alternatives you've considered
Add a sourcemap to the npm release package, or a single file debug build (in
node_modules/geostyler-openlayers-parser/browser
) This highlighted the problem quite quickly and allowed easy debugging. This may be the better solution as it may be possible to style clustered filters using functions?A single file debug build would be very useful for many situations when developing.