0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Mapbox Studio のデータアップロード方法、Datasets API もあるよ!

Posted at

データのアップロード方法

過去にこちらでアップロード方法をまとめました。

Datasets API を使ったアップロード方法

今回はAPIを使ったデータのアップロードを紹介します。

APIマニュアルはこちらをごらんください。

upload.py
import mapbox
from mapbox import Uploader

# Mapboxアクセストークンを設定
access_token = 'YOUR_MAPBOX_ACCESS_TOKEN'
mapbox.config.update(access_token=access_token)

# アップロードするファイルのパス
file_path = 'path/to/your/file.geojson'

# Mapbox Uploader インスタンスの作成
uploader = Uploader()

# アップロードするタイルセットの名前を指定
tileset = 'your_mapbox_username.tileset_id'

# アップロード
with open(file_path, 'rb') as src:
    upload_resp = uploader.upload(src, tileset)

# アップロードレスポンスを確認
print(upload_resp.status_code)
print(upload_resp.json())
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?