首页 / 浏览问题 / 云GIS / 问题详情
mapbox加载切片地图,加载出来是白板
39EXP 2019年11月20日

mapbox加载切片地图显示出来是白板。用leaflet可以正常显示。

代码如下:

map.addSource('pd-gd', {
        'type': 'raster',
        'tiles': [
          'http://211.136.105.71:8090/iserver/services/map-NWJG/rest/maps/ZP_ZGG/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}&transparent=true'
        ],
        'tileSize': 256
      });
      map.addLayer({
        'id': 'tileIserver',
        'type': 'raster',
        'source': 'pd-gd'
      });

1个回答

你好,请问你的地图服务原始是什么坐标系的,如果是4326 4490等 你可以参考我们的官网示例的多坐标系,检查是否库文件一致都引入
3,352EXP 2019年11月20日
两个地图坐标系都是4326的,这一个没有加载出来,没有报错,只是加载出来白板。
你对比过我刚才说的官网例子吗? 这个文件你是否引入<script type="text/javascript" include="mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>0
我直接放管网demo里做的

就改了中心点、缩放等级等参数。

var map = new mapboxgl.Map({
        container: 'map',
        style: {
            "version": 8,
            "sources": {
                "raster-tiles": {
                    "attribution": attribution,
                    "type": "raster",
                    "tiles": ['http://211.136.105.71:8090/iserver/services/map-NWJG/rest/maps/ZP_ZGG/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
                    "tileSize": 256,
                },
            },
            "layers": [{
                "id": "simple-tiles",
                "type": "raster",
                "source": "raster-tiles",
                "minzoom": 0,
                "maxzoom": 22
            }]
        },
        center: [ 121.6, 31.1 ],
        maxZoom: 22,
        zoom: 16
    });

根据地图参数

私信你 给你远程,你设置下 crs: 'EPSG:4326',
谢谢 463910331
问题解决 <script type="text/javascript" include="mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script> 并设置src为4490即可
...