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] show vector tile labels on top #69444

Merged
merged 16 commits into from
Jul 3, 2020
Merged

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Jun 17, 2020

Fixes #35035

This PR adds labelsOnTop setting to LayerDescriptor. When true, label mapbox layers will be moved to the top of the map.

Screen Shot 2020-06-28 at 9 30 00 PM

@nreese nreese added release_note:enhancement WIP Work in progress [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 v7.9.0 labels Jun 17, 2020
@nreese nreese requested a review from a team as a code owner June 17, 2020 19:54
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@jsanz
Copy link
Member

jsanz commented Jun 18, 2020

The thing with labels on top is that once you see them, you can't unsee them and you compare any other map by this feature.

Still, in my experience, there are users that still want to have the option to have them below their business data, or even not having labels at all. I can imagine the second being outside the scope of this PR, but I wonder if the first can be doable as a basemap layer setting.

@nreese
Copy link
Contributor Author

nreese commented Jun 18, 2020

Still, in my experience, there are users that still want to have the option to have them below their business data, or even not having labels at all. I can imagine the second being outside the scope of this PR, but I wonder if the first can be doable as a basemap layer setting.

This option can be made configurable if that is desired.

@nreese
Copy link
Contributor Author

nreese commented Jun 26, 2020

@elasticmachine merge upstream

@nreese nreese removed the WIP Work in progress label Jun 29, 2020
@nreese
Copy link
Contributor Author

nreese commented Jun 29, 2020

@jsanz @thomasneirynck I have updated this PR and its ready for review.

Changes:

  1. Fixed sort logic so now sorting works with labels on top
  2. The setting is now configurable in layer settings panel
  3. The setting is turned off by default to ensure maps do not change when users upgrade.

@nreese
Copy link
Contributor Author

nreese commented Jun 29, 2020

@elasticmachine merge upstream

1 similar comment
@nreese
Copy link
Contributor Author

nreese commented Jun 29, 2020

@elasticmachine merge upstream

@thomasneirynck thomasneirynck self-requested a review June 29, 2020 21:42
@nreese
Copy link
Contributor Author

nreese commented Jul 1, 2020

@elasticmachine merge upstream

@nyurik
Copy link
Contributor

nyurik commented Jul 2, 2020

  • There are two types of labels: "symbol labels" (a horizontal label attached to a point), and "linestring labels" (a label that follows a geometry, e.g. the name of a road). This only becomes apparent at high zooms. In my previous experience, it may make sense to bring only the symbol labels to the top, while leaving the road/river labels under the choropleth selection. On the other hand, in some cases lake labels could also be done as linestrings, and those may need to be looked at. One possible solution -- offer a multi-option choice rather than a checkbox -- all above / all below / only point labels above

  • We may want to use the same label placing system for both the base map labels as well as the geojson labels, giving the geojson labels higher priority. This way basemap labels would disappear (or possibly be auto-moved?) instead of overlapping.

@nreese
Copy link
Contributor Author

nreese commented Jul 2, 2020

There are two types of labels: "symbol labels" (a horizontal label attached to a point), and "linestring labels" (a label that follows a geometry, e.g. the name of a road)

Is there a way to tell symbol labels and linestring labels apart just by looking at the layer style? When the labels are sorted, there is not any context about which mapbox layers do what. We can isolate labeling layers but I am not sure we can isolate the difference between symbol labels and linestring labels.

@nreese nreese requested review from a team as code owners July 2, 2020 17:33
@nreese nreese removed request for a team July 2, 2020 17:36
@nreese nreese removed Team:Fleet Team label for Observability Data Collection Fleet team Team:APM All issues that need APM UI Team support labels Jul 2, 2020
@nreese
Copy link
Contributor Author

nreese commented Jul 2, 2020

The linestring labels have the property "symbol-placement": "line" inside the layout section. Does it help?

That does help. Is this a distinction we want to make?

@jsanz
Copy link
Member

jsanz commented Jul 2, 2020

Not really sure. If I understand correctly, @nyurik comment was more in line of having just the place names on the top, so it's not only the linestrings but also other layers like points of interest, waterway names, etc. that would be below.

Looking at the layer list, I understand we would want to push up just the symbol layers starting with place-

image

I've checked the three styles and they all have this group of lists on the top, so the pattern is consistent for EMS basemaps.

@thomasneirynck
Copy link
Contributor

thomasneirynck commented Jul 2, 2020

That does help. Is this a distinction we want to make?

that could be an additional improvement, but I would keep this PR to the basics: pull labels to top from the EMS-baselayer.

This feature ("pulling labels to the top") can always grow when we start getting real-world feedback.

There's a lot of outstanding improvements wrt. "pulling labels to top":

^ I don't think this PR needs to address nuances like that until we get real-world use.

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

Only some nits.

Great scope of the functionality for a first pass. It unblocks APM, and puts the core in place to grow this if so desired.

Thank you so much for fixing technical debt wrt layer-ordering. Maps now can reliably order any number of layer-reorderings. e.g. consider a client of the MapsEmbeddable replacing the layer-list with an arbitrary re-ordering. This is now functional.

layerClass: LAYER_CLASS,
beneathMbLayerId?: string
) {
const mbLayers = mbMap.getStyle().layers!; // check ordering against mapbox to account for any upstream moves.
Copy link
Contributor

Choose a reason for hiding this comment

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

will ! force the creation of an empty mbLayer array?

x-pack/plugins/maps/common/descriptor_types/sources.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

nice!

@nreese
Copy link
Contributor Author

nreese commented Jul 2, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nreese nreese merged commit ebcec3a into elastic:master Jul 3, 2020
nreese added a commit to nreese/kibana that referenced this pull request Jul 3, 2020
* [Maps] show vector tile labels on top

* experiment with new sort algorithm

* clean up

* remove old sort method

* add unit test for sort layer

* tslint

* clean up

* make labelsOnTop configurable

* tslint

* more tslint

* add another test case for single layer move

* clarify should messages

* fix assert not null operators

* review feedback

* update snapshot

Co-authored-by: Elastic Machine <[email protected]>
nreese added a commit that referenced this pull request Jul 3, 2020
* [Maps] show vector tile labels on top

* experiment with new sort algorithm

* clean up

* remove old sort method

* add unit test for sort layer

* tslint

* clean up

* make labelsOnTop configurable

* tslint

* more tslint

* add another test case for single layer move

* clarify should messages

* fix assert not null operators

* review feedback

* update snapshot

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 3, 2020
* master: (32 commits)
  [Ingest Pipelines] Load from json (elastic#70297)
  [Rum Dashbaord] Rum selected service view (elastic#70579)
  [Uptime] Prevent duplicate requests on load for index status (elastic#70585)
  [ML] Changing shared module setup function parameters (elastic#70589)
  [Ingest Manager] Add ability to sort to agent configs and package configs (elastic#70676)
  [Alerting] document requirements for developing new action types (elastic#69164)
  Fixed adding an extra space character on selecting alert variable in action text fields (elastic#70028)
  [Maps] show vector tile labels on top (elastic#69444)
  chore(NA): upgrade to lodash@4 (elastic#69868)
  Add Snapshot Restore README with quick-testing steps. (elastic#70494)
  [EPM] Use higher priority than default templates (elastic#70640)
  [Maps] Fix cannot select Solid fill-color when removing fields (elastic#70621)
  [kbn/optimizer] only build specified themes (elastic#70389)
  Fix saved query modal overlay (elastic#68826)
  Update component templates list to render empty prompt inside of content container. Show detail panel when deep-linked, even if there are no component templates. (elastic#70633)
  [Security Solution] Renames the `Investigate in Resolver` Timeline action (elastic#70634)
  fix 400 error on initial signals search (elastic#70618)
  [Maps] fix unable to edit heatmap metric (elastic#70606)
  Update network idle timeout (elastic#70629)
  [APM] Disable flaky useFetcher test (elastic#70638)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 3, 2020
* master: (199 commits)
  [Telemetry] Add documentation about Application Usage (elastic#70624)
  [Ingest Manager] Improve agent unenrollment with unenroll action (elastic#70031)
  Handle timeouts on creating templates (elastic#70635)
  [Lens] Add ability to set colors for y-axis series (elastic#70311)
  [Uptime] Use elastic charts donut (elastic#70364)
  [Ingest Manager] Update registry URL to point to snapshot registry (elastic#70687)
  [Composable template] Create / Edit wizard (elastic#70220)
  [APM] Optimize services overview (elastic#69648)
  [Ingest Pipelines] Load from json (elastic#70297)
  [Rum Dashbaord] Rum selected service view (elastic#70579)
  [Uptime] Prevent duplicate requests on load for index status (elastic#70585)
  [ML] Changing shared module setup function parameters (elastic#70589)
  [Ingest Manager] Add ability to sort to agent configs and package configs (elastic#70676)
  [Alerting] document requirements for developing new action types (elastic#69164)
  Fixed adding an extra space character on selecting alert variable in action text fields (elastic#70028)
  [Maps] show vector tile labels on top (elastic#69444)
  chore(NA): upgrade to lodash@4 (elastic#69868)
  Add Snapshot Restore README with quick-testing steps. (elastic#70494)
  [EPM] Use higher priority than default templates (elastic#70640)
  [Maps] Fix cannot select Solid fill-color when removing fields (elastic#70621)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] Seperate Maps and Map Labels
6 participants