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] Add mvt format for ES-doc sources #74319

Closed
wants to merge 54 commits into from

Conversation

thomasneirynck
Copy link
Contributor

@thomasneirynck thomasneirynck commented Aug 4, 2020

WIP

Partially addresses #58519

Summary

This adds an .mvt vector tile option for Elasticsearch geo_shape documents.

This allows display of a large amount of documents. The display of the geometries is optimized for scale. When zoomed in, the full geometry is returned, when zoomed out, a simplified geometry is shown.

image
`

Introduce a new scaling-type "mvt tiles"

image

Extend ESSearchSource to implement

This is different from the original POC (#57248), which introduced a new source type altogether. There are some advantages to just extending the existing ESSearchSource.

  • less code overall
  • toggling scaling-type can re-use the same infrastructure which was in place for blended-layers, without having to accommodate "source-type-swapping"

Add new getTile route-backend

The URL encodes all relevant state. By doing so, the existing logic in TiledVectorLayer that determines when and how to swap mb-sources remains functional.

Introduce the concept of a too many features bounds

When the number of features exceeds the ES-limit, the tile contains a bounds of where the features are.

image

This is somewhat a "one-off"-addition, but imho it is relevant for the .mvt scaling type. This bounds indicates the user where the data is, but does not show the actual geometries. This is a similar approaches exist in other toolkits. The goal is to give users an indication of where to zoom-in.

e.g. consider building footprints for an entire US-state. There are too many to display at once (in the millions), and even if Maps could display them all at once, at zoomed out scales they would be much smaller than a pixel to see.

This needs design work. The current hash-pattern is somewhat ugly.

Future work

For feature completeness, following functionality needs to be added: (excluded from this PR, to keep changes to a minimum).

  • add support for geo_point
  • add support for grid/cluster layers as tiles

Todo

  • unit tests for the new contracts and UX
  • API integration tests for the new route
  • functional tests for round-trip verification
  • ts type check
  • Language
  • Known bugs
    • should only include necessary field-properties
    • time based data? allow/disallow?

@@ -160,6 +160,11 @@ export class TiledVectorLayer extends VectorLayer {
return false;
}

if (!mbTileSource.tiles) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because the layer-type and the underlying representation in mb changes when toggling between scaling-types. It needs to check it the mb-source is compatible with the layer-type.

@@ -836,6 +867,18 @@ export class VectorLayer extends AbstractLayer {
type: 'geojson',
data: EMPTY_FEATURE_COLLECTION,
});
} else if (mbSource.type !== 'geojson') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs to remove incompatible source-types and layers

@@ -143,6 +147,15 @@ export class MBMap extends React.Component {
mbMap.addControl(new mapboxgl.NavigationControl({ showCompass: false }), 'top-left');
}

const hatchImageBase64 =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADhCAYAAAByfIirAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAKYUAACmFAY9V/uEAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuNWWFMmUAAAlLSURBVHhe7dtRCuNmEoXREGb/S5h9ZHWZkhiBQXVjrB9cinw+aEM3nFwRCj9Zf1R/15+/6s9/tr+86c/689/6s5njD9vHsin2uvU/KsSyKXbOXobb39lzLJti1+3bEtz+/V0sm2LZ1GU7MlqxbIpl20ZGK5ZNsWzbyGjFsimWbRsZrVg2xbJtI6MVy6ZYtm1ktGLZFMu2jYxWLJti2baR0YplUywbmxhln223XzJP7LLPtvsv5K/AqQdm72+3o9reFbtip56Zvb897uqro+yzrS8rNrViX+9q/1h5e/obD8z+O6276mOvW0cVYtesu+pj16yjamLXrbs6x67bt93tgdlzLJv6KTsyWrFsimXbRkYrlk2xbNvIaMWyKZZtGxmtWDbFsm0joxXLpli2bWS0YtkUy7aNjFYsm2LZtpHRimVTLBubGGWfbbdfuU/sss+2+9sTV+DUA7P3t9tRHW/Wf2qnnpm9vz3u6quj7LOtLys2tWJf72r/8GZ9H7tm3VUfe906qhC7Zt1VH7tmHVUTu27d1Tl23b7tbg/MnmPZ1E/ZkdGKZVMs2zYyWrFsimXbRkYrlk2xbNvIaMWyKZZtGxmt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qZ+yI6MVy6ZYtm1ktGLZFMu2jYxWLJti2baR0YplUyzbNjJasWyKZdtGRiuWTbFs28hoxbIplm0bGa1YNsWysYlR9tl2+5X7xC77bLu/PXEFTj0we3+7HdXxZv2nduqZ2fvb466+Oso+2/qyYlMr9vWu9g9v1vexa9Zd9bHXraMKsWvWXfWxa9ZRNbHr1l2dY9ft2+72wOw5lk39lB0ZrVg2xbJtI6MVy6ZYtm1ktGLZFMu2jYxWLJti2baR0YplUyzbNjJasWyKZdtGRiuWTbFs28hoxbIplo1NjLLPttuv3Cd22Wfb/e2JK3Dqgdn72+2ojjfrP7VTz8ze3x539dVR9tnWlxWbWrH/v6s//v4fiP+fU3FxzHsAAAAASUVORK5CYII=';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to explore better designs for this one.

@thomasneirynck thomasneirynck requested a review from a team August 14, 2020 07:17
@nreese
Copy link
Contributor

nreese commented Aug 17, 2020

This is really neat.

Would it be possible to keep the dynamic icon from vector layer when using vector tiles from elasticsearch? Notice how the icon in the legend changes when switching to vector tiles.

Screen Shot 2020-08-17 at 7 37 00 AM

Screen Shot 2020-08-17 at 7 37 07 AM

@thomasneirynck thomasneirynck marked this pull request as ready for review August 18, 2020 13:19
@elasticmachine
Copy link
Contributor

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

ppisljar and others added 9 commits August 21, 2020 15:26
* refactor: 💡 move timeRange, filters and query to base embeddabl

* refactor: 💡 use new base embeddable input in explore data

* feat: 🎸 import types as types
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Server side changes

- removed console_legacy plugin!
- added new es_config endpoint that returns server side es config
  at the moment this is just the first value in hosts
- Slight refactor to how routes are registered to bring them more
  in line with other ES UI plugins

* Client side update

- Updated the client to not get es host from injected metadata.
  Instead use the new endpoint created server side that returns
  this value
- Added a small README.md regarding the hooks lib and need to
  refactor use of jQuery in console
- Write code to init the es host value on the client once at start
  up in a non-blocking way. If this fails we just use the default
  value of http://localhost:9200 as this powers non-essential
  console functionality (i.e., copy as cURL).

* fix type issue and jest tests

* fix another type issue

* simplify proxy assignment in proxy handler mock

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…tic#75536)

* move csp usage collector from legacy kibana plugin to kibana_usage_collection

* make scripts/telemetry_check happy.

* remove assertion on legacy kibana plugin

* remove test on legacy kibana plugin

* update README
…c#75163)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
add unit tests

functional boiler plate

fine tune

remove cruft
@thomasneirynck thomasneirynck requested review from a team as code owners August 21, 2020 19:26
@thomasneirynck thomasneirynck requested a review from a team August 21, 2020 19:26
@thomasneirynck thomasneirynck requested review from a team as code owners August 21, 2020 19:26
@thomasneirynck thomasneirynck requested a review from a team August 21, 2020 19:26
@thomasneirynck thomasneirynck requested review from a team as code owners August 21, 2020 19:26
@botelastic botelastic bot added Feature:Embedding Embedding content via iFrame Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) Team:Fleet Team label for Observability Data Collection Fleet team labels Aug 21, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@thomasneirynck
Copy link
Contributor Author

sorry all for the spam. I messed up my rebase. Closing this one and will re-open.

@kibanamachine
Copy link
Contributor

kibanamachine commented Aug 21, 2020

💔 Build Failed

Failed CI Steps

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
console 163 +4 159
esUiShared 227 +1 226
kibanaUtils 189 -2 191
visTypeMarkdown 258 +2 256
visTypeTimeseries 468 -1 469
total +4

async chunks size

id value diff baseline
console 1.1MB +2.9KB 1.1MB
visTypeMarkdown 40.7KB -1.0B 40.7KB
visTypeTimeseries 1.8MB -386.0B 1.8MB
visualize 694.0KB +123.0B 693.9KB
total +2.6KB

page load bundle size

id value diff baseline
console 30.4KB -175.0B 30.6KB
embeddable 430.5KB +632.0B 429.9KB
esUiShared 989.2KB +1.1KB 988.1KB
expressions 346.6KB -2.3KB 348.9KB
kibanaUtils 470.4KB -2.5KB 472.8KB
savedObjects 237.4KB +43.0B 237.3KB
visTypeMarkdown 556.3KB +3.1KB 553.2KB
visualizations 407.4KB -456.0B 407.8KB
total -554.0B

History

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

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 Feature:Embedding Embedding content via iFrame Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.