Skip to content

Commit

Permalink
safely handle cases where there are no scene layers
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnnnii committed Jun 28, 2024
1 parent 0cbf9a8 commit 3d738c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/components/download/create-mesh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default async function createMesh(scene: WebScene, extent: Extent, signal
const ground = scene.ground;

const layers = scene.allLayers.filter(layer => layer.type === "scene").toArray() as SceneLayer[];
const sr = layers.at(0)!.spatialReference;

const sr = layers.at(0)?.spatialReference ?? extent.spatialReference;

const features = (await Promise.all(layers.map(layer => extractFeatures(layer, extent, signal)))).flat();
const projectedExtent = projection.project(extent, sr) as Extent;
Expand Down
2 changes: 0 additions & 2 deletions app/routes/$scene/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import { Suspense, lazy } from "react";
import { redirect, useLoaderData, useRouteError } from "@remix-run/react";
import Sidebar from "~/components/sidebar/sidebar";
import invariant from "tiny-invariant";
import SCENES from "~/data/scenes";
import { ViewUI } from "../../components/arcgis/views/scene-view/scene-view-ui";
import { CalciteAction, CalciteNavigation, CalciteNavigationLogo, CalciteNavigationUser, CalciteScrim } from "@esri/calcite-components-react";
import { SelectionAction } from "../../components/selection/selection-button";
import GraphicsLayer from "~/components/arcgis/graphics-layer";
import SelectionExtent from "../../components/selection/selection-graphic";
import WalkthroughPopover from "~/components/walk-through/walk-through-popover";
import { load as loadProjectionEngine } from "@arcgis/core/geometry/projection";
import SelectionErrorAlert from "~/components/selection/selection-error-alert";
import { useSceneListModal } from "~/components/scene-list-modal/scene-list-modal-context";
import { useAccessorValue } from "~/hooks/reactive";
Expand Down

0 comments on commit 3d738c9

Please sign in to comment.