Poonam Patil
Poonam Patil

Reputation: 11

Mapbox : How to generate source url for vector type

I am trying to add source to my map, but don't know how to generate the url. Did check the documentation, which shows :

map.addSource('counties', {
  "type": "vector",
  "url": "mapbox://mapbox.82pkq93d" **<--------------- How to generate this URL?**
  });

I tried generating map-id using the export tileset at following URL :

https://studio.mapbox.com/datasets/

map.on('load', function() {
  map.addSource('counties', {
  "type": "vector",
  "url": "mapbox://mapbox.82pkq93d"
  });
  map.addLayer({
            "id": "water",
            "type": "fill",
            "source": "composite",
            "source-layer": "water",
            "filter": ["all"],
            "layout": {},
            "paint": {"fill-color": "hsl(205, 76%, 70%)"},
            "properties" : {"COUNTY":"Ashland County","FIPS":55003,"median-income":39172,"population":16065} **<--- This has to be present in the source and not layer.**
        })
}

Just need to generate the URL on my own so I can add the properties section in GeoJson

Upvotes: 1

Views: 665

Answers (1)

philoez98
philoez98

Reputation: 493

You can get that url in mapbox studio. Near every source/dataset there's a link that you can copy and reference in your code.

Upvotes: 1

Related Questions