elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.76k stars 8.16k forks source link

[Maps] Add a UI "sort by" option to determine render order for features #135262

Open nickpeihl opened 2 years ago

nickpeihl commented 2 years ago

Describe the feature:

Maplibre has several *-sort-key properties (example) to set the render order for features on a map. We could allow users to choose a metric (ascending or descending) to change the order features are rendered. This could be useful for cluster, document, top hits, tracks, and source to destination layers. It is not really useful for grid or hexagon layers since those features do not overlap.

Describe a specific use case for the feature:

On a source to destination map, one source might have several destinations that are geographically close together. For example, a source from South Africa might have destinations in NYC and Boston. The NYC line may be much thicker if we use a count metric. In that case, the thinner line to Boston may be nearly completely obscured. If we could order the rendering so smaller count metrics draw last, the thinner Boston line may draw on top of the NYC line. So we should be able to easily see both.

** Affected layers

This mostly only affects point to point layers.

elasticmachine commented 2 years ago

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

elasticmachine commented 1 year ago

Pinging @elastic/kibana-presentation (Team:Presentation)

nreese commented 10 months ago

Just ran into this today while investigating https://github.com/elastic/kibana/issues/170272.

Here is an example of where this problem manifests. The example looks at kibana sample web logs sorted by @timestamp - descending. We should expect to see newest items on top and oldest items on bottom with regards to z-index.

With vector tile scaling, this is not the case. Maplibre renders features from first to last, meaning first features are displayed underneath later features. Notice the scale and how oldest items, light blue colors, are on top of newest items, dark blue colors. So in this case, the newest features are rendered underneath the oldest features. The opposite of what we want.

Screenshot 2023-11-15 at 11 04 33 AM

With geojson scaling, we actually reverse order of the features so that maplibre draws them as expected. This is a hack and is not possible with vector tile layers.

Screenshot 2023-11-15 at 11 04 22 AM
nreese commented 10 months ago

Changing impact to high since features are not rendered as expected and this allows for easier misinterpretations of the map.

Maps should use sort layout properties on default timestamp field so that newest items appear on top of older items.