deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug] Using @deck.gl/arcgis,Abnormal display of multiple DeckLayers

Open gdnwr opened this issue 2 years ago • 2 comments

Description

When using the latest version @deck.gl/[email protected]: Two DeckLayers were created separately, with the first layer displaying correctly and the second layer not displaying. However, when using @deck.gl/[email protected] and earlier versions, both layers display correctly. Upon comparison, it was found that starting from @deck.gl/[email protected], the parameter "depthTest=true" has been added.

// deck.gl\modules\arcgis\src\commons.js
parameters: {
      depthTest: true
}

Flavors

  • [X] Script tag
  • [ ] React
  • [ ] Python/Jupyter notebook
  • [ ] MapboxOverlay
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [X] ArcGIS

Expected Behavior

Hope to have multiple DeckLayers loaded in ArcGIS, all displaying correctly.

Steps to Reproduce

https://codesandbox.io/p/sandbox/arcgis-deck-xz57ww?file=%2Findex.html%3A17%2C76

The above example is a simple modification of:https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=custom-lv-deckgl

When using @deck.gl/[email protected] and earlier versions, both layer and layer2 display normally; however, from version 8.1.7 and above, only the first loaded layer is displayed.

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>
      Build a custom layer view using deck.gl | Sample | ArcGIS Maps SDK for
      JavaScript 4.28
    </title>

    <script src="https://unpkg.com/[email protected]/dist.min.js"></script>
    <script src="https://unpkg.com/@deck.gl/[email protected]/dist.min.js"></script>
    <!-- Only displaying the red layer. -->
    <script src="https://unpkg.com/@deck.gl/[email protected]/dist.min.js"></script>
    <!-- The red layer and the blue layer2 are both displaying normally -->
    <!-- <script src="https://unpkg.com/@deck.gl/[email protected]/dist.min.js"></script> -->
    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.28/esri/themes/light/main.css"
    />
    <script src="https://js.arcgis.com/4.28/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>

    <script>
      require(["esri/Map", "esri/views/MapView"], (Map, MapView) => {
        deck.loadArcGISModules().then((arcGIS) => {
          const layer = new arcGIS.DeckLayer();

          setInterval(() => {
            layer.deck.layers = [
              new deck.TripsLayer({
                id: "trips_1",
                data: "https://raw.githubusercontent.com/uber-common/deck.gl-data/master/examples/trips/trips-v7.json",
                getPath: (d) => {
                  return d.path;
                },
                getTimestamps: (d) => {
                  return d.timestamps;
                },
                getColor: (d) => {
                  return d.vendor === 0 ? [253, 128, 93] : [23, 184, 190];
                },
                opacity: 1.0,
                widthMinPixels: 4,
                rounded: true,
                trailLength: 180,
                currentTime: (performance.now() % 20000) / 10,
                shadowEnabled: false,
              }),
            ];
          }, 50);

          const layer2 = new arcGIS.DeckLayer();

          setInterval(() => {
            layer2.deck.layers = [
              new deck.TripsLayer({
                id: "trips_2",
                data: "https://raw.githubusercontent.com/uber-common/deck.gl-data/master/examples/trips/trips-v7.json",
                getPath: (d) => {
                  return d.path;
                },
                getTimestamps: (d) => {
                  return d.timestamps;
                },
                getColor: (d) => {
                  return d.vendor === 0 ? [0, 0, 255] : [23, 184, 190];
                },
                opacity: 1.0,
                widthMinPixels: 6,
                rounded: true,
                trailLength: 180,
                currentTime: (performance.now() % 2000) / 10,
                shadowEnabled: false,
              }),
            ];
          }, 50);

          const mapView = new MapView({
            container: "viewDiv",
            map: new Map({
              basemap: "dark-gray-vector",
              layers: [layer, layer2],
            }),
            center: [-74, 40.72],
            zoom: 14,
          });
        });
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

Environment

  • Framework version:
  • Browser:
  • OS:

Logs

No response

gdnwr avatar Jan 10 '24 02:01 gdnwr

Layer ids must be unique.

If you still believe there is a bug, please note that v8.1 is not actively maintained. We will only investigate bugs on the latest release.

Pessimistress avatar Jan 10 '24 04:01 Pessimistress

Layer ids must be unique.

If you still believe there is a bug, please note that v8.1 is not actively maintained. We will only investigate bugs on the latest release.

Hello, the latest version of @deck.gl/[email protected], still has this issue. This problem persists from version 8.1.7 to 8.9.33, as depthTest=true was introduced starting from version 8.1.7.

Examples have been modified: The id of DeckLayer is automatically generated by ArcGIS, and the IDs of layers within different DeckLayers have been changed to different values, but the result remains unchanged.

The introduction of "

gdnwr avatar Jan 10 '24 07:01 gdnwr