-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Implement fields and bounds retrieval on GeoJsonFileSource #88294
[Maps] Implement fields and bounds retrieval on GeoJsonFileSource #88294
Conversation
Pinging @elastic/kibana-gis (Team:Geo) |
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.
LGTM - just one small comment about a more descriptive test name
code review
x-pack/plugins/maps/public/classes/sources/geojson_file_source/geojson_file.test.ts
Outdated
Show resolved
Hide resolved
💚 Build SucceededMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
Makes two additions:
VectorSource#getFields
implementaiton to GeoJsonFileSource. Does this by adding an internal__fields
property. This enables dynamic styling for this source.This blocks #88416. This PR would enable for ML to style the anomalies based on a custom color scheme, as well as get the auto-fitting behavior on startup.
Clients would use this like this:
additional context
auto-fit-for-bounds does not work for non-ES sources. This is because auto-fitting implicitly relies on bounds-retrieval to be supported without data syncing
kibana/x-pack/plugins/maps/public/actions/map_actions.ts
Line 118 in 4b2c9de
This means that the fallback in
vector_layer
for sources which are notisBoundsAware
does not work ifsyncData
has not completed yet.kibana/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx
Line 243 in 0ac6e62
This approach works for 99% of use-cases, since any vector source is mostly backed by Elasticsearch. It is also important that auto-fit must work without fetching the data.
The
GEOJSON_FILE
source seems to be the exception.In order for auto-fitting to work before the data is loaded, the
GEOJSON_FILE
source needs to support bounds-retrieval.Rather than changing the implementation of auto-fit, or expanding on the API, the easiest solution would be for
GEOJSON_FILE
to implement thegetBounds
method.For maintainers