-
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
Fix feature properties #1612
Fix feature properties #1612
Conversation
I have done a review of all OpenLayers feature getProperties() use cases. These should always be stored as const featureProperties with the OL feature as F. Please double check the cluster label assignment. This is now working for me but was bugged. |
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.
Working for me now.
@dbauszus-glx We noticed another issues with wkt layers and assigning properties from the featureFormats module. The params fields were assigning in a weird way with a 2 step shift in the array, which would result in undefined being assigned into the properties, and then spreading them in will make other properties undefined as well. So if we make 'id' undefined in this part // Populate featureFields values array with feature property values.
layer.params.fields?.forEach((field, i) => {
layer.featureFields[field].values.push(feature[i + 2]);
properties[field] = feature[i + 2]
}) It would then spread id:undefined into the ol.feature // Return feature from geometry with properties.
return new ol.Feature({
id: feature.shift(),
geometry: formatWKT.readGeometry(feature.shift(), {
dataProjection: 'EPSG:' + layer.srid,
featureProjection: 'EPSG:' + layer.mapview.srid,
}),
...properties
}) I have corrected it in this commit : a86974e |
@RobAndrewHurst I don't understand the shift change. I have two fields retailer, and store. This means they are indexed 2 and 3. With 0 being the id and 1 being the geometry. Removing the +2 in shift breaks WKT featureFormats method for me. |
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.
The latest change of removing the +2 in the WKT featureFormats shift breaks the format.
Yeah we noticed that now! We have come up with a fix! Will document the fix now! |
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.
Looking much cleaner now.
Quality Gate passedIssues Measures |
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.
Nice one!
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.
Happy with this - tested on a range of layer formats
Description
The properties are now spread into the OL element and we need to correct the feature properties references.
GitHub Issue
#1610
Type of Change