-
Notifications
You must be signed in to change notification settings - Fork 25
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
Remove grid format, mod, and legend; optional layer qid; vector format viewport; featureFormats util & theme.field_stats #871
Conversation
@RobAndrewHurst Styling should be fixed in 56e27d7 The properties object must not be spread when being assigned to the feature. |
@dbauszus-glx I noticed a bit of code duplication in the featureFormats.mjs module. There was an if statement if (layer.style?.theme?.field_stats) {
layer.style.theme.updated = true;
layer.style.theme.field_stats[layer.style.theme.field] = {
values: []
};
} which I then put into a function which is now referenced in both the geojson and wkt functions. Let me know if you are happy with that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review for PR #871
😃 I've reviewed the PR and more specifically the module relating to processing GeoJSON and WKT formats using the OpenLayers library. Here's my feedback:
1. Clarity & Readability 🌟
The code is clear and well-structured. Functions are named descriptively, which makes the module easy to understand even for someone unfamiliar with the domain specifics.
2. Code Duplication 🔍
There's a pattern in both geojson
and wkt
functions where we push a value into field_stats
. While this isn't strictly duplicate code due to the different data structures being processed, it may be worth keeping an eye on this if further operations get added in the future. Consider further refactoring if this becomes more complex.
3. Documentation 📝
Consider adding more comments to explain the purpose of each function, the expected format of its parameters, and any other quirks or nuances that might help a developer unfamiliar with this module.
4. Use of Utility Function 👍
The introduction of the initializeFieldStats
utility function is a commendable move. This ensures that any initialization related logic is contained within its own function, thus keeping the main functions clean and adhering to the Single Responsibility Principle.:+1:
In Conclusion
The module is well-structured and makes good use of utility functions to minimize redundancy. Great work overall! 🚀
vector.mjs:101 throws below exception with certain url params: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getFeatures') |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
The grid format has been removed as it is currently bugged. #873
In order to replace the grid format the vector format must be configurable to reload the data within the viewport when the viewport changes. Vector layer will reload the data from source with a viewport if the
viewport: true
flag is set on the layer. Thelayer.reload()
will be triggered from the mapviewchangeEnd
event.Vector layer will use
layer.tableCurrent()
instead oflayer.table
and not load data from source if there is no current table.Vector feature properties should be spread on the vector feature and not be assigned as
feature.properties.properties
.The grid format had a dynamic theme.
Dynamic themes require stats for the field used in theme. These stats can only be calculated from a series of field values which will be populated when the features are processed. The
theme.updated
flag will be set allowing the theme method to only process the required field statistics once prior to deleting the flag. #306The
featureFormats
have been removed from the vector module and added as mapp.utils.The optional layer qID bug #874 has been addressed in this issue.