markdown 将Mapbox中的栅格加载到具有透明度的Leaflet或ArcGIS JS API中

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 将Mapbox中的栅格加载到具有透明度的Leaflet或ArcGIS JS API中相关的知识,希望对你有一定的参考价值。

# Problem

When loading raster data containing transparent pixels from Mapbox, those transparent pixes show up as black. This happens in both Leaflet and ArcGIS JS API.

# Suggested Solutions
[Troubleshoot raster image with black background](https://www.mapbox.com/help/troubleshoot-raster-transparency-issues/)

I was trying to access the style I had added the raster tiles to. Even though it shows up the way I'd expected in Mapbox Studio, when rendering for Leaflet, all the transparent pixels were black. Other methods either wouldn't load anything. Lots of errors!

I was using the suggestion from the style's share and develop page. They suggested:
https://api.mapbox.com/styles/v1/maptastik/cjez077k42lak2rs48w2rvgpw/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwdGFzdGlrIiwiYSI6IjNPMkREV1kifQ.2KGPFZD0QaGfvYzXYotTXQ

# My solution

[Mapbox API Documentation > Retrieve Tiles](https://www.mapbox.com/api-documentation/#retrieve-tiles)

- Use the `.png` ending
- For ArcGIS JS API, use `{level}/{col}/{row}` rather than `{z}/{x}/{y}`
- `https://api.mapbox.com/v4/<Map ID from tileset/{z}/{x}/{y}.png?access_token=your-access-token


Include and example of it working and not working with both ArcGIS JS API and Leaflet. Show how it works normally with Mapbox GL JS

以上是关于markdown 将Mapbox中的栅格加载到具有透明度的Leaflet或ArcGIS JS API中的主要内容,如果未能解决你的问题,请参考以下文章