1

I've added MapBox map layer in my HTML page using following script.

mapboxgl.accessToken =
    '***********************';
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/light-v10',
    zoom: 6,
    center: [84.1015344, 28.3911862]

});

Everything is great but there is default map label which is cluttered and I don't want them in my analysis part. So, how can I remove those labels?

Here is the image of the generated map with too much labels in it.

enter image description here

1 Answer 1

0

I couldn't make change to the default light or dark theme but discovered about Mapbox studio which helps to customize the map according to out need. So, I created Mapbox studio custom map with turning off all the label layers i didn't need for the project.

1
  • Hello, sorry a bit late, can you try to execute the following function inside the javascript console of your browser ? map.getStyle(). map must be your mapboxgl.Map instance. In the output, look at the layers attributes, it's an array containing all the layers loaded in your map. You must find the one displaying the labels and then call : map.setLayoutProperty(THE-LAYER-ID-HERE, 'visibility', 'none'); it should fix the problem.
    – Marc
    Feb 12, 2021 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.