Repository navigation
Add topojson support / EMS v3 support - #15361
Conversation
|
In theory we could standardize our topojsons to always have the same object hierarchy. We don't have to use multiple top-level subobjects, but instead standardize on |
|
P.S. I used this approach in Kartotherian - https://github.com/kartotherian/geoshapes/blob/master/geoshapes.js#L406 |
|
I'm going to expand this PR to support other EMS v3 features
|
617e23d to
f324422
Compare
|
I added support for multibase layer (hypothetical, since EMS doesn't publish multiple layers yet). It's a rough outline, not intende to go in as-is. I changed the wms-options now to wrap the entire baselayer configuration.
|
|
@timroes @ppisljar This is an outline still, but most of the features that should go in, are in. I'm not sure if we need "more" features in order to support the use-case. Tests/docs are missing. The biggest issue is that we actually don't have an EMS v3 yet. So this requires some manual configurations in the yaml to make topojson work. Things that can be evaluated already:
I'd like to merge #15507 as well, so I can rebase with the added unit tests. So I'd prioritize that one first for review. |
b0884d7 to
ebcd630
Compare
There was a problem hiding this comment.
- Get rid of the
linkfunction if we don't need it. - Use child scope for the directive instead of writing to
vis.paramsdirectly in the template.
|
I wonder if we should integrate https://github.com/briannaAndCo/Leaflet.Antimeridian into this as well, to solve all potential anti-meridian issues. Might need to evaluate performance hit, or make it optional (e.g. the catalog file will mark a certain dataset as requiring a special antimeridian handling) |
2747325 to
d195a76
Compare
|
Attached is an example topojson file that you can use for testing. It works with the makelogs data. Drop it in |
ppisljar
left a comment
There was a problem hiding this comment.
some minor comments and some additional questions ...
need to do some more testing before approving
There was a problem hiding this comment.
The module doesn't seem to be much used and kept up to date ? (seems last change was half a year ago). Can we rely on it ?
There was a problem hiding this comment.
it seems legit to me. Written by the creator of d3 and frequently downloaded. It's a subset of https://www.npmjs.com/package/topojson, with only some conversion functions.
There was a problem hiding this comment.
the only change in this file is the removal of this empty line ....
There was a problem hiding this comment.
what was the default outlineWeight before ?
There was a problem hiding this comment.
the comment should probably move on its own line to make it easier to notice.
There was a problem hiding this comment.
why are this defaults hardcoded here and not read from vis.params ?
There was a problem hiding this comment.
These settings are driven by the base-layers and those are read from the EMS-manifests. These are just placeholders when we create the map, but they get overridden as baselayers are configured.
I did create variables for them.
There was a problem hiding this comment.
why only updating map zoom if maxZoom is bigger than current maxZoomLevel ?
There was a problem hiding this comment.
changes to this file are unnecessary, should remove to make the change cleaner
There was a problem hiding this comment.
can you quickly explain why all this calls to updateChoroplethLayer ? (4 calls to updateChoroplethLayerForXXX)
There was a problem hiding this comment.
After looking into this more in-depth, I can't really trigger this being called 4 times in a single render call.
This may get called 2 times in a single render call. Once when there is a data change and once when there is a change in the params.
These checks arose due to a limitation of leaflet, that doesn't allow us to change the data after we have assigned it to a layer. That's why we need to check if we can reuse the existing layer or create a new instance. Whether we can reuse it depends on a number of factors:
- if any parameters change that affect the join-parameters, we cannot reuse the instance
- if the data changes, we cannot reuse the instance.
I think it is working as intended. The checks avoid recreating an instance of the leaflet-layer and downloading new data when we shouldn't. This is an important feature. If we remove this and redraw the visualization from scratch for each render call, this will absolutely kill responsiveness of the map.
There was a problem hiding this comment.
this diff got really bad, most of this functions did not really change just their position in the file did ....
94a77e9 to
449441c
Compare
|
@nyurik wrt. antemeridian. I wouldn't make this part of this PR, but we can consider it. Our reliance on leaflet plugins is a long term liability rather than an asset. I'd reevaluate when we get more community feedback on this issue. Feel free to create a bug report for it too. |
|
i don't have any more comments on code and as far as i could test this seems to work. |
There was a problem hiding this comment.
Besides some minor code suggestions and the still missing tests and docs this LGTM. Though, also after some readings and watching Thomas' explanation to Peter, I still don't have a very deep understanding of the domain, so not sure if I could validate everything correctly.
There was a problem hiding this comment.
I guess we shouldn't rely on non breaking whitespaces for styling, but rather fix the accordingly CSS. Also as far as I know since the switch to EUI, these icons now looks okay spacing wise. Maybe rebase this on master and remove that whitespace.
There was a problem hiding this comment.
I guess the true isn't needed here?
There was a problem hiding this comment.
I preferred the promise to resolve to a success-flag iso. of just undefined, as it's being used as a boolean check by the client.
There was a problem hiding this comment.
I am fine with leaving it in, even though I think, the promise should just reject if there are cases where it's not successful, and a resolved promise should always mean successful, which would render the true useless imho. But I won't nitpick on this one :D
There was a problem hiding this comment.
i agree 100% that if promise was not succesful it should reject instead of resolve with false
There was a problem hiding this comment.
I think this could be shortened, by using the .find method?
const fileService = catalogue.services.find(service => service.type === 'file');
if (!fileService) {
return [];
}There was a problem hiding this comment.
.find could be used here too
77d8e8d to
33714c1
Compare
|
jenkins, test this |
|
Please don't comment out tests, but rather use |
| const northWest = bounds.getNorthWest(); | ||
| if ( | ||
| southEast.lng === northWest.lng && | ||
| southEast.lng === northWest.lng || |
There was a problem hiding this comment.
the and-case didn't trap the case where the visualization would have a width, but not a height (or vice-versa).
|
Does this PR break previously created visualizations, that has a custom map server configured? They would now require a EMSv3 server, while beforehand an EMSv2. Is EMSv3 backward compatible, so this visualization will still work with any EMSv2 server? If not I think we need a breaking change warning on this, since it would require all users with custom map servers to update Kibana in parallel to upgrade their map server to use EMSv3. |
|
old visualizations should still work, we can't expect users to recreate all their map visualizations. same seems to happen for region map |
Dismiss Approval until backward compatibility is fixed.
|
@timroes there doesn't need to be backward compatibility between Kibana 6.2 and up, and EMSv2. Kibana 6.2 will only connect to EMSv3 and never to any of the older EMS-endpoints. Likewise, none of the older versions of Kibana will connect to EMSv3. From the EMS end, we do need to ensure that every service that is published in v2 remains available in EMSv3. This is to ensure that maps saved in older versions will have the same look&feel when reopened in a later version of Kibana. |
|
thanks @ppisljar . That's a bug due to the service-settings for EMS only being loaded in the UI-editor component. I will fix this. |
|
@timroes there are also no user-hosted EMS-versions, so users will not be able to run v2 themselves. |
ppisljar
left a comment
There was a problem hiding this comment.
LGTM, i wonder if we could reenable the other test as well ?
| expect(prettyPrint).to.equal('Today'); | ||
| }); | ||
| }); | ||
| // describe('time changes', function () { |
There was a problem hiding this comment.
what about this test? could we reenable this one as well ?
|
also update PR description and open a new issue for the docs and link it here ? |
|
last test run before merging. jenkins, test this |
This adds support for the v3 endpoint of the Elastic Maps Service. This includes support for Topojson files.
|
Backport: |
|
@thomasneirynck do we have functional tests for this PR? Thanks! |
|
@bhavyarm there's no additional functional test, although there is more unit test. This is mostly a backend change to accomodate the new EMS-service, less so a functional change in Kibana. |
This adds support for the v3 endpoint of the Elastic Maps Service. This includes support for Topojson files.
This PR adds support for Topojson and the EMS v3 maps backend. It also refactors some of the common code between Coordinate Map and Region Map.
This is a rough outline for adding topojson support to Region Maps. Closes #14331.Adding topojson layers raises a few new issues that need to be solved.
I changed it to use a map, but even that should be improved. It's probably wrong to rely on the onFeature callbacks coming out of Leaflet, which have no defined order. Rather, we should just do that join ourselves.(SHOULD EVALUATE IF THIS WAS WORTH IT)