<jupyter_start><jupyter_text>Mapbox upload<jupyter_code>import requests<jupyter_output><empty_output><jupyter_text>Create tileset source<jupyter_code># !pip install mapbox-tilesets
# !tilesets list-sources csaladenes --token $mapbox_api_key
# !tilesets list csaladenes --token $mapbox_api_key
# !tilesets validate-source uat_daily.json
!tilesets upload-source csaladenes roeim uat_daily.json --replace --token $mapbox_api_key
# recipe={
#   "version": 1,
#   "layers": {
#     "uat_fills": {
#       "source": "mapbox://tileset-source/csaladenes/roeim",
#       "minzoom" : 0,
#       "maxzoom" : 12
#     }
#   }
# }
# open('uat_recipe.json','w').write(json.dumps(recipe))
# !tilesets validate-recipe uat_recipe.json --token $mapbox_api_key
# !tilesets create csaladenes.roeim --recipe uat_recipe.json --name "roeim tiles" --token $mapbox_api_key
!tilesets publish csaladenes.roeim --token $mapbox_api_key
# !tilesets job csaladenes.roeim cknf9bbhe000808jtfeanc4i4 --token $mapbox_api_key
# url='https://api.mapbox.com/tilesets/v1/csaladenes.roeim/recipe?access_token='+mapbox_api_key
# r=requests.get(url)
# tileset=json.loads(r.content)
# tileset
url='https://api.mapbox.com/tilesets/v1/sources/csaladenes/roeim?access_token='+mapbox_api_key
r=requests.get(url)
json.loads(r.content)
url='https://api.mapbox.com/tilesets/v1/csaladenes.roeim?access_token='+mapbox_api_key
r=requests.get(url)
json.loads(r.content)<jupyter_output><empty_output><jupyter_text>No need for the below, once created in MB - just update the dataset<jupyter_code>mapbox_api_key=open('auth/mapbox.txt','r').read()
url='https://api.mapbox.com/styles/v1/csaladenes/<STYLE_ID>?access_token='+mapbox_api_key
r=requests.get(url)
mbstyle=json.loads(r.content)
mbstyle.pop('modified');
mbstyle.pop('created');
for i in [0,1,2]:
    mbstyle['layers'][i]['source']='roeim tiles'
    mbstyle['layers'][i]['source-layer']='mapbox://tileset-source/csaladenes/roeim'
url='https://api.mapbox.com/styles/v1/csaladenes//<STYLE_ID>?access_token='+mapbox_api_key
r = requests.patch(url, json.dumps(mbstyle), headers=head)
r<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1605873993368072, 'fraction_numerical': 0.00994789199431549, 'mean_word_length': 6.384615384615385, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '191975', 'license': 'MIT', 'n_tokens_mistral': 859, 'n_tokens_neox': 850, 'n_words': 107, 'path': 'jupyter/map-create-dataset.ipynb', 'repo_name': 'denesdata/roem', 'size': '2111'}