Skip to content Skip to sidebar Skip to footer

How To Add Tile Layer To Map Using Mapboxgl.js

Here m adding tile created using tiff mapboxgl.accessToken ='pk.eyJ1IjoiZ2F1cmF2Y2F0c3RlY2giLCJhIjoiY2l1cGo0MTl4MDAxajJ1bng5a2xieTY0diJ9.0fDXNulI91U85ngSc4jGCg'; var map = new ma

Solution 1:

I do not believe the "source-layer": "contour" is applicable for raster sources whatsoever. See https://www.mapbox.com/mapbox-gl-js/example/map-tiles/ So get rid of that line.Looks like you will need a "tileSize": 256 option included as well on the source.

Also your layout and paint options are going to be unneeded as well.Those are options for vector or geojson sources. Those types of controls are not available on raster.

Solution 2:

The simplest way is to simply edit the tile layer in Mapbox Studio, and then upload it to mapbox.js. This way all you have to do is provide the link to the style as a source (Mapbox has a TON of documentation for this).

Post a Comment for "How To Add Tile Layer To Map Using Mapboxgl.js"