问题
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