1

I've been working with Mapbox GL JS and working with adding data layers over the base map. For some reason, I keep getting a 404 error on a requested tile even though the data overlay shows up as expected. I've checked and double checked to make sure that I got the source id and source layer references correct, using this as a reference point.

This is the snippet I'm having issues with.

map.addSource('neighborhoods', {
  type: 'vector',
  url: 'mapbox://shortdiv.cj4u72j500fu72qplj0xcusp3-738n8'
})

map.addLayer({
    'id': 'neighborhood-bounds',
    'source': 'neighborhoods',
    'source-layer': 'chicago_neighborhoods',
    'type': 'line',
    'paint': {
      "line-color": "#ad0403",
      "line-width": 2
    }
});

Fiddle for reference

1 Answer 1

2

It is returning 404 for tiles in areas that contain no data in your custom dataset, so the Mapbox Uploads API did not create the tile, and thus it does not exist and 404s when requested. You're not doing anything wrong and your map should still work as expected. We suppress the errors on the mapbox-gl-js side, but there is no way to suppress the error generated by the browser.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.