将 ArcGIS Server REST 服务 API 消费到 MapBox GL API 中

use*_*839 3 arcgis-server mapbox mapbox-gl mapbox-gl-js

我可以将 ArcGIS Server REST 服务 API 消费到 MapBox GL API 中吗?请任何人告诉我是否可以将 ArcGIS Rest 服务消费到 MapBox GIS 中。谢谢!!

Bjo*_*son 5

您可以使用 GeoJSON 作为要素服务的中间格式。ArcGIS Server从 10.4 版本开始支持 GeoJSON ,并且 MapBox GL API 支持读取 GeoJSON

这是一个片段:

map.on('load', function () {
    // Add a layer showing the city parks
    map.addLayer({
        'id': 'parks-layer',
        'type': 'fill',
        'source': {
            'type': 'geojson',
            'data': 'https://services.arcgis.com/V6ZHFr6zdgNZuVG0/ArcGIS/rest/services/City_of_Redlands_Parks/FeatureServer/0/query?where=1%3D1&outSR=4326&f=pgeojson'
        },
        'paint': {
            'fill-color': 'rgba(200, 100, 240, 0.3)',
            'fill-outline-color': 'rgba(200, 100, 240, 1)'
        }
    });
});
Run Code Online (Sandbox Code Playgroud)