首页 / 浏览问题 / WebGIS / 问题详情
使用原生mapboxgl如何加载iserver发布的mvt矢量瓦片服务
257EXP 2023年06月21日
RT,请问使用原生的mapboxgl如何加载超图iserver发布的矢量瓦片服务ugcv5(mvt)?

原生mapboxgl!!!

原生mapboxgl!!!

原生mapboxgl!!!

1个回答

您好,原生mapbox加载iserver发布的mvt矢量瓦片服务方式和官网示例一样。

官网示例:https://iclient.supermap.io/examples/mapboxgl/editor.html#mvtVectorTile

博客参考:https://blog.csdn.net/yangyoung4/article/details/124100377

1,865EXP 2023年06月21日
不一样,你提供的示例都是超图改造的mapboxgl,原生的没有这些对象和方法,比如原生没有addStyle这个方法。
1、如果是加载iserver发布的mvt矢量瓦片服务是和官网示例一样的,可以直接使用以下示例:

<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

    <title>Add an icon to the map</title>

    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">

    <!-- <link href="https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.css" rel="stylesheet">

    <script src="https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js"></script> -->

    <script src="https://api.mapbox.com/mapbox-gl-js/v1.4.1/mapbox-gl.js"></script>

    <link href="https://api.mapbox.com/mapbox-gl-js/v1.4.1/mapbox-gl.css" rel="stylesheet">

    <style>

        body {

            margin: 0;

            padding: 0;

        }

        #map {

            position: absolute;

            top: 0;

            bottom: 0;

            width: 100%;

        }

    </style>

</head>

<body>

    <div id="map"></div>

    <script>

        var map = new mapboxgl.Map({

        container: 'map', // container id

        style: 'https://iserver.supermap.io/iserver/services/map-mvt-China/rest/maps/China/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true',

        center: [120.143, 30.236], // starting position

        zoom: 0,

        attributionControl: false

    });

    map.addControl(new mapboxgl.NavigationControl(), 'top-left');

    </script>

</body>

</html>

2、您如果想要其他原生的地图引擎开发商(mapbox)加载iserver发布的服务,应该去咨询需要加载的地图引擎官方,而不是服务提供方,我们这边只能保证超图自己的产品加载。
...