-
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
Vega Maps Referencing from kibana.yml #88316
Conversation
if (!baseMapOpts) { | ||
this.onWarn( | ||
i18n.translate('visTypeVega.mapView.mapStyleNotFoundWarningMessage', { | ||
defaultMessage: '{mapStyleParam} was not found', | ||
values: { mapStyleParam: `"mapStyle": ${JSON.stringify(mapStyle)}` }, | ||
}) | ||
); | ||
} else { |
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.
impossible case. for all cases if (!baseMapOpts) {
returns false
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.
Agreed that this logic is an impossible case (which is causing a bug), but a warning should be logged if const mapOptions = tmsServices.find((s) => s.id === mapStyle);
returns undefined.
To view the issue, add map.includeElasticMapsService: false
to your kibana.dev.yml. Then remove map.tilemap.url
as well. This will disable EMS so mapOptions will be undefined. Then, running vega will fail because baseMapOpts is not properly defined
I would recommend returning null from getMapStyleOptions
if mapOptions
is undefined. Then, add logic to the caller of getMapStyleOptions
to check for null and log the warning if the return is null.
I am ok if you do not want to fix this issue in this PR, instead, we can just create a new issue and tackle this in a separate thread.
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.
was fixed it that PR
|
||
let mapStyle; | ||
|
||
if (mapConfig.mapStyle !== 'default') { |
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.
to discuss: in accordance with the following documentation https://www.elastic.co/guide/en/kibana/6.8/vega-with-a-map.html mapStyle
param accepts just a 2 values: false
and default
.
It looks a little odd to me because in some cases it might be useful to let the user set a specific tms layer value. For example, if I set map.tilemap.url
param and want to create some vis with that layer and some with the default one (road_map
)
{
$schema: https://vega.github.io/schema/vega/v5.json
config: {
kibana: {
type: map
mapStyle: road_map
}
}
}
To add support of that we just need to remove the following if
statement from vis_type_vega/public/data_model/vega_parser.ts
if (res.mapStyle !== `default` && res.mapStyle !== false) {
this._onWarning(
i18n.translate('visTypeVega.vegaParser.mapStyleValueTypeWarningMessage', {
defaultMessage:
'{mapStyleConfigName} may either be {mapStyleConfigFirstAllowedValue} or {mapStyleConfigSecondAllowedValue}',
values: {
mapStyleConfigName: 'config.kibana.mapStyle',
mapStyleConfigFirstAllowedValue: 'false',
mapStyleConfigSecondAllowedValue: '"default"',
},
})
);
res.mapStyle = `default`;
}
@nreese @thomasneirynck from your point of view should we support that case or not?
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.
I like the idea of allowing users to specify which base layer to use. I think this would be best completed in a separate PR so the implementation can be discussed outside of the context of this fix.
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.
agree, it will be done out of that PR, just wanted to discuss it firstly
Pinging @elastic/kibana-app (Team:KibanaApp) |
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 - thanks for fixing this issue.
code review, tested in chrome
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
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, tested in Safari. Works as expected 🙂
* Vega Maps Referencing from kibana.yml Closes: elastic#87853 * update translations * fix PR comments
Closes: #87853
Summary
"Vega maps should use
map.tilemap.url
when provided instead of getting its base map layer fromElastic
map service"Steps to reproduce:
Change map.tilemap.url from default to point to another map tile service, like Openmaptiles.
Open Vega in kibana and attempt to layer a map using the help guide found at https://www.elastic.co/guide/en/kibana/6.8/vega-with-a-map.html
For testing:
env
params for your Kibana instance (you can do it inconfig/kibana.yml
)map.tilemap.url: http://c.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg
Kibana
instance and create/open Vega visualization with Map layer. You can use the following empty vega spec for testing"mapStyle": false
user should be able to disable base layer.