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

Layers disappear on zoom #399

Open
nstjean opened this issue Feb 11, 2020 · 15 comments
Open

Layers disappear on zoom #399

nstjean opened this issue Feb 11, 2020 · 15 comments

Comments

@nstjean
Copy link
Contributor

nstjean commented Feb 11, 2020

I noticed a bug: This map works great when simpleMenu: true but when the browser menu is used the layers are disappearing on zoom.

Peek 2020-02-11 11-55

Here's the code I used in multipleMaps.html:

      var bounds = new L.LatLngBounds(
        new L.LatLng(84.67351257, -172.96875),
        new L.LatLng(-54.36775852, 178.59375)
      );

      var map = L.map("map", {
        maxBounds: bounds,
        maxBoundsViscosity: 0.75,
      }).setView([43, -83], 3);
      map.options.minZoom = 3;

      var map2 = L.map("map2", {
        maxBounds: bounds,
        maxBoundsViscosity: 0.75,
      }).setView([43, -83], 3);
      map2.options.minZoom = 3;

      L.LayerGroup.EnvironmentalLayers({
        include: ['odorreport', 'asian', 'clouds', 'eonetFiresLayer', 'Unearthing', 'PLpeople'],
        addLayersToMap: true,
        // simpleLayerControl: true,
      }).addTo(map);

      L.LayerGroup.EnvironmentalLayers({
        // include: ['odorreport', 'asian', 'clouds', 'eonetFiresLayer', 'Unearthing', 'PLpeople'],
        // display: ['odorreport', 'clouds', 'eonetFiresLayer', 'Unearthing'], 
      }).addTo(map2);

I also noticed that those layers aren't listed at all in the browser menu. But this might just be a result of the changes we made in #396

@nstjean
Copy link
Contributor Author

nstjean commented Feb 11, 2020

@crisner

@crisner
Copy link
Contributor

crisner commented Feb 11, 2020

That is because it is filtered out by the layer menu. It is not supposed to be visible at that map bounds or zoom. It appears because we are forcing it to display on the map by default.

@nstjean
Copy link
Contributor Author

nstjean commented Feb 11, 2020

Ahhhh. Ok. I see it did behave this way before our changes .

@crisner
Copy link
Contributor

crisner commented Feb 11, 2020

When a user is browsing the layer will only be available in the layer's zoom and bounds. So a user might set it to appear by default only when the layer is available. It would disappear when the map moves away from its bounds or the map is zoomed out.

@nstjean
Copy link
Contributor Author

nstjean commented Feb 11, 2020

I do see that with simpleLayerControl: true the map asian does disappear at zoom 10 and higher. Which is expected. But when simpleLayerControl: false it disappears as soon as I zoom the map at all - and it does not turn back on.

@crisner
Copy link
Contributor

crisner commented Feb 11, 2020

It gets removed from the map. Justice map is available from zoom level 5. You will have to turn it back on when it is available in the layer menu.

@crisner
Copy link
Contributor

crisner commented Feb 11, 2020

If this seems unintuitive we can remove the code responsible for removing the layer from the map. The issue then would be there would be no way to turn off the layer when it is filtered off the layer menu.

@crisner
Copy link
Contributor

crisner commented Feb 11, 2020

We should perhaps look into a better way for layer filtering? Maybe look into how the layer should behave with the map when it is filtered out?

@nstjean
Copy link
Contributor Author

nstjean commented Feb 11, 2020

Ahhh, I see. Yeah that doesn't seem intuitive to me.

So it behaves differently depending on which menu is up because the browser menu doesn't have all the layers in there? I noticed a lot are missing, such as Unearthing.

@crisner
Copy link
Contributor

crisner commented Feb 12, 2020

Yes. The layer menu in LEL is different from the default one. We essentially want the users to work with LEL's layer menu. The layers are filtered out because we don't want the user requesting data out of the layer's extents and we don't want the layer menu to be too long.

Here's how we could go about making the experience better.

  1. Once a layer is added to the map let the layer be visible both on the map and the layer menu but keep the layer from requesting data if the map is not intersecting with the layer's extents.

  2. The layers that are not displayed on the map will be filtered from the layer menu. We could add a feature that lets the user decide if they want to keep the layers filtered or if they want everything to be listed.

  3. We have an alert that notifies users of new layers available. We may have to highlight the new layers as well so the users can locate the new layers easily.

@nstjean, @jywarren, and @sagarpreet-chadha, What do you think?

@nstjean
Copy link
Contributor Author

nstjean commented Feb 13, 2020

Ohhhhhh, I see!! That is neat!

I don't see the Wisconsin layer showing up at all, even when I zoom in to Wisconsin, though. We will want to check into that and make sure the visibility settings are correct.

  1. That makes sense.
  2. I like that idea, a toggle button in the menu to "show all layers"
  3. Yes I like that idea of highlighting the new ones! It's hard to tell right now.

@crisner
Copy link
Contributor

crisner commented Feb 14, 2020

I don't see the Wisconsin layer showing up at all, even when I zoom in to Wisconsin, though. We will want to check into that and make sure the visibility settings are correct.

Yes. I've come across that too. The data is requested only when map view is on 'Eau Claire'. Not sure why it was coded that way. Probably because the data is not available in other parts of Wisconsin? We'll need to check if that's the case.

@nstjean
Copy link
Contributor Author

nstjean commented Feb 17, 2020

It seems to only show if you are zoomed in really close. We can maybe adjust that.

@sagarpreet-chadha
Copy link
Collaborator

Hey,
The above layer and all similar layers (asian, etc.) are fetched only once, so let's not make them disappear abruptly.

@crisner
Copy link
Contributor

crisner commented Feb 22, 2020

Fixed in #409. We will no longer be removing layers that are displayed on the map. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants