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

Add option to turn off buildings and roads layers #56

Open
batpad opened this issue Dec 19, 2024 · 1 comment
Open

Add option to turn off buildings and roads layers #56

batpad opened this issue Dec 19, 2024 · 1 comment
Assignees

Comments

@batpad
Copy link
Collaborator

batpad commented Dec 19, 2024

Right now, when viewing Raster maps like the SOI maps, etc., the map is obstructed / overlayed by buildings and road layers that there is no current way to turn off.

I can see that there's situations where it's nice to see the context of present day roads and buildings, but I also think it's nice to be able to see the raster layers without overlays on top?

@planemad how hard would it be to make some sort of toggle for this? I think for now just a single toggle to "Show Roads and Buildings" or so, can be checked by default? It might be nice to have more granular control of layers to show, but I don't think we should worry about that right now?

@planemad does this seem reasonable and would you know how to implement this or where to look? I don't think I'd know quite where to start with the mapbox stuff.

@planemad planemad self-assigned this Dec 20, 2024
@planemad
Copy link
Contributor

planemad commented Dec 20, 2024

👌 definitely an option we should have.

We can start with a general option: Basemap which just has an on/off toggle for the associated map layers.

Basic Implementation
map-layer-control.js

  • Add support for a new layer type to map-layer-control.js for mapbox-streets. This type will not have any opacity control.
  • On style.load read all the style layer ids with the tileset source mapbox://mapbox.mapbox-streets-v8 and store as an array for this layer control.
  • When the layer control is toggled on/off, use https://docs.mapbox.com/mapbox-gl-js/example/toggle-layers/ to show/hide the associated list of layers

index.html

  • Add a mapbox-streets layer to the MapLayerControl constructor
  title: 'Basemap',
  description: 'Buildings, Roads, Landuse and Place labels from [Mapbox Streets](https://docs.mapbox.com/data/tilesets/reference/mapbox-streets-v8/)',
  attribution: '[© Mapbox](https://www.mapbox.com/about/maps/), [© OpenStreetMap](https://www.openstreetmap.org/about/)'
  headerImage: 'assets/map-layer-mapbox.png',
  type: 'mapbox-streets',

In future, we can have sub layer control like 'Roads', Buildings', 'Places' each with a checkbox toggle or even style/color picker for finer customization.

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

2 participants