3

Can I consume ArcGIS Server REST services API into MapBox GL API? Please can anyone tell me whether I can consume an ArcGIS Rest Service into MapBox GIS. Thanks!!

Bjorn Svensson
  • 815
  • 8
  • 21
user6694839
  • 389
  • 1
  • 2
  • 7
  • I don't think you can access the ArcGIS REST API using MapBox GL API, but you can access services published to ArcGIS Server by using other protocols: WMS, WMTS, GeoJSON etc depending on your type of service. Are you asking about tile services or feature services or ... ? – Bjorn Svensson May 05 '17 at 19:38
  • Trying to access feature services... – user6694839 May 06 '17 at 05:30

2 Answers2

5

You can use GeoJSON as your go-between format for feature services. ArcGIS Server supports GeoJSON since version 10.4 and MapBox GL API supports reading GeoJSON.

Here's a snippet:

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)'
        }
    });
});
Bjorn Svensson
  • 815
  • 8
  • 21
0

You can use Esri's arcgis-to-geojson-utils to convert arcgis rest services featureset result to geojson format, which can be used with mapbox-gl.

zhimin
  • 2,740
  • 12
  • 22