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] Fit to Data is not working with EMS Boundaries #66582

Closed
jsanz opened this issue May 14, 2020 · 4 comments · Fixed by #66607
Closed

[Maps] Fit to Data is not working with EMS Boundaries #66582

jsanz opened this issue May 14, 2020 · 4 comments · Fixed by #66607
Assignees
Labels
bug Fixes for quality problems that affect the customer experience [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation

Comments

@jsanz
Copy link
Member

jsanz commented May 14, 2020

Kibana version:
master

Elasticsearch version:
master

Server OS version:
ubuntu 19.10

Browser version:
Chromium: 81.0.4044.138 (Official Build) (64-bit)

Browser OS version:
ubuntu 19.10

Original install method (e.g. download page, yum, from source, etc.):
sources

Describe the bug:

The Fit to data feature in Maps is not working for layers based on EMS Boundaries

Steps to reproduce:

  1. Create a map
  2. Add an EMS Boundaries layer (say Andorra)
  3. Click on the tooltip Fit to data or the global Fit to data bounds button
  4. The map stays at worldwide bounds

Expected behavior:
Map zooms to the country boundaries.

@jsanz jsanz added bug Fixes for quality problems that affect the customer experience [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation labels May 14, 2020
@elasticmachine
Copy link
Contributor

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

@jsanz
Copy link
Member Author

jsanz commented May 14, 2020

Issue detected when testing #66452

@thomasneirynck
Copy link
Contributor

thomasneirynck commented May 14, 2020

oddly enough, this does work but only when the EMS-layer has term-joins.

@nreese
Copy link
Contributor

nreese commented May 14, 2020

The problem is in https://github.com/elastic/kibana/blob/master/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.js#L162. FEATURE_VISIBLE_PROPERTY_NAME is only set when joins are applied. I can create a fix

_getBoundsBasedOnData() {
    const featureCollection = this._getSourceFeatureCollection();
    if (!featureCollection) {
      return null;
    }

    const visibleFeatures = featureCollection.features.filter(
      feature => feature.properties[FEATURE_VISIBLE_PROPERTY_NAME]
    );
    const bbox = turf.bbox({
      type: 'FeatureCollection',
      features: visibleFeatures,
    });
    return {
      minLon: bbox[0],
      minLat: bbox[1],
      maxLon: bbox[2],
      maxLat: bbox[3],
    };
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants