Reputation: 451
I have a vector source(tileset) uploaded on mapbox studio. I am adding a source with this tileset like :
map.addSource("abc", {
type: "vector",
url: "mapbox://RELEVANT_MAP_ID"
});
then I am trying to add a layer like:
map.addLayer({
"id": "layer_id",
"type": "line",
"source": "abc",
"source-layer": "source_layer_id",
"layout": {
"line-join": "round",
"line-cap": "round"
},
"paint": {
"line-color": "#ff69b4",
"line-width": 4
}
});
When I execute this code I get an error :
Error: Source layer "source_layer_id" does not exist on source "abc" as specified by style layer "terrain-data"
What exactly the source_layer is for ? How do I mention the source layer on source in case of vector tiles ? Is there any way to mention the source layer while creating the tile set?
Upvotes: 1
Views: 2373
Reputation: 3065
If you open your tileset (the one refereced by your RELEVANT_MAP_ID) in Mapbox Studio you'll see something like this
The source-layer
is which layer within that Tileset source you want to create the Style Layer for, so from the screenshot it could be admin
, aeroway
, airport_label
, etc.
Upvotes: 2