Debugging MapboxGL

From WPRDC Wiki
Revision as of 22:37, 18 November 2021 by Steve (talk | contribs) (added a start)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Some errors fail silently in mapbox and this can be annoying when you can't make a layer show up.  A few things to make sure you check:

  1. Vector layers require a source-layer prop or argument.  Often times, silent failing can be simply because the source layer is wrong.  When using a tile server response from profiles.wprdc.org, make sure the source-layer is the same as the table name (`<schema>.<table/view>).
  2. Look in the network pane of your browser's dev tools and ensure that the requests to the source data are working.
  3. Make sure the projections are correct.  Connect the source in a desktop GIS like QGis and see if the data is showing elsewhere. I'm fairly certain that mapbox requires the data to already be in WGS 84 Web Mercator .
  4. If you see tile data coming in the network pane (.pbf, .mvt, etc.) check to see if they have any data.  If data in your target area is empty (i.e. 0 bytes), this could be a sign the projection is incorrect.