URL for Mapbox style sheet JSON

倾然丶 夕夏残阳落幕 提交于 2021-02-11 14:28:17

问题


Is there a URL that serves up the style sheet JSON for a given style? All the URL's are in Mapbox scheme:

mapbox://styles/wfisher/41dj33random72ravc31c5dyn

But I'd like to download the JSON directly on load so I can modify it before passing in a Javascript object to <ReactMapGL>.


回答1:


You have to use the Mapbox Static API:

https://www.mapbox.com/api-documentation/#retrieve-a-style

so the URL would be:

https://api.mapbox.com/styles/v1/wfisher/41dj33random72ravc31c5dyn?access_token=<token>

and the sever will compress it if you use Accept-Encoding, too.



来源:https://stackoverflow.com/questions/53602656/url-for-mapbox-style-sheet-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!