Skip to content
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

[Maps] Use mapbox feature-state for dynamic properties and upgrade mapbox-gl to 0.54 #36466

Merged
merged 24 commits into from
May 22, 2019

Conversation

thomasneirynck
Copy link
Contributor

@thomasneirynck thomasneirynck commented May 10, 2019

Closes #34396

Switching dynamic styling no longer requires registering the data-source with mapbox. This is a great performance improvement, especially for larger data since the geometries no longer need to be processed and moved to the GL-context by mapbox (they are already on the map after all) for each change in the style-expression. Because of this, we can also simplify the style-syncing logic since the maps-app no longer needs to keep track whether it needs to reset the data.

By naively introducing this, the map got a "wash"-effect as new data from ES gets loaded when panning/zooming/querying. That's likely because mapbox is still having the feature-state of the old feature-set registered, when the new style is applied. See comment in code explaining the issue in more detail, and the proposed work-around to resolve this wash effect.

This also required an upgrade of mapbox-gl, as the current dependency did not include the removeFeatureState method yet.

Perhaps #36059 could resolve that issue. That PR will introduce assign a unique ID to features from ES (the ES-docId), so no feature-id will be reused across resultsets.

This does not resolve the issue that property selection in dynamic styling causes a full data round-trip if the dynamic property has not been retrieved yet.

@thomasneirynck thomasneirynck added WIP Work in progress [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 v7.2.0 labels May 10, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@thomasneirynck
Copy link
Contributor Author

jenkins, test this

@thomasneirynck thomasneirynck changed the title [Maps] Use mapbox feature-state for dynamic properties [Maps] Use mapbox feature-state for dynamic properties and upgrade mapbox-gl to 0.54 May 14, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

feature.properties[FEATURE_ID_PROPERTY_NAME] = (typeof feature.id === 'string' || typeof feature.id === 'number') ? feature.id : i;
const id = generateNumericalId();
feature.properties[FEATURE_ID_PROPERTY_NAME] = id;
feature.id = id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a breaking change. What if the vector source populates id field and users expect to see their id value in a tooltip and now they see our implementation value. Maybe not a big deal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature#id is not accessible as a tooltip-value. Only index-pattern properties are accessible, and they are put as-is under Feature#properties

@thomasneirynck
Copy link
Contributor Author

jenkins, test this

1 similar comment
@thomasneirynck
Copy link
Contributor Author

jenkins, test this

@thomasneirynck thomasneirynck removed the WIP Work in progress label May 21, 2019
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
code review, tested in chrome

@thomasneirynck
Copy link
Contributor Author

jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@thomasneirynck
Copy link
Contributor Author

jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@nreese
Copy link
Contributor

nreese commented May 22, 2019

Looks like test failure is caused by changes. The functional test may need to be reworked because the current test looks for the scaled property in the feature collection and now with feature state this may have changed. I can take a look tomorrow

@thomasneirynck
Copy link
Contributor Author

thomasneirynck commented May 22, 2019

@nreese correct, see 673fef3

due to the mapbox-upgrade, we also need to explicitly include the visibility property when comparing styles 8da6521, something which was omitted in earlier versions.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@nreese
Copy link
Contributor

nreese commented May 22, 2019

7.2 got branched before 7.x backport was merged. Backported to 7.2 with #36945

nreese pushed a commit that referenced this pull request May 23, 2019
nreese added a commit that referenced this pull request May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:fix v7.2.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] use mapbox feature-state iso feature-properties for data-driven styling
3 participants