Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 1.5 KB

load-arcgis-modules.md

File metadata and controls

52 lines (41 loc) · 1.5 KB

loadArcGISModules

This utility function initializes the classes in this module by loading ArcGIS dependencies. Optionally, it can also load additional dependencies from the esri namespace.

Usage

import {loadArcGISModules} from '@deck.gl/arcgis';

loadArcGISModules(['esri/Map', 'esri/views/MapView'], {version: '4.21'})
  .then(({DeckLayer, DeckRenderer, modules}) => {
    const [ArcGISMap, MapView] = modules;

    const layer = new DeckLayer({
      'deck.layers': [
        new ScatterplotLayer({
          data: [
            {position: [0.119, 52.205]}
          ],
          getPosition: d => d.position,
          getColor: [255, 0, 0],
          radiusMinPixels: 20
        })
      ]
    });

    const mapView = new MapView({
      container: "viewDiv",
      map: new ArcGISMap({
        basemap: "dark-gray-vector",
        layers: [layer]
      }),
      center: [0.119, 52.205],
      zoom: 5
    });
  });

Arguments:

loadArcGISModules(modules, loadScriptOptions);
  • modules (Array, optional) - Array of esri modules to load, passed to esri-loader's loadModules
  • loadScriptOptions (Object, optional) - esri-loader options

Returns: a promise that resolves to an object with the following fields:

  • DeckLayer
  • DeckRenderer
  • modules (Array) - if the modules argument was specified, will represent an array of the resolved objects