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中的主要内容,如果未能解决你的问题,请参考以下文章

mapbox建筑显示不全

将栅格中的值检索到具有不同范围和分辨率的另一个栅格中

qgis中加载矢量切片

【GIS】矢量瓦片,GeoServer+Mapbox

栅格瓦片 笔记二:瓦片数据的生成

mapbox.gl源码解析——基本架构与数据渲染流程