-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Throw error for Clustered Features with filters #227
Comments
@geographika thanks for creating this issue.
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?
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
for the rule and use TextSymbolizer with {{features}} template. The missing thing seems to be a way how to pass |
HACK is needed to style cluster layers. It wraps existing OL style function in a function which searches for for Text styles and in them for serialized feature arrays and instead sets the len gth of this array as the label. If the geostyler text symbolizer had {{features}} as the text label template (which returns the "features" attribute of the parent/cluster feature) and returned '[object Object], [object Object]' the result would become "2". See geostyler/geostyler-openlayers-parser#227
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.
The text was updated successfully, but these errors were encountered: