Skip to content

Commit fc11595

Browse files
authored
Merge pull request #299 from Esri/Caleb/New-DisplayWebSceneFromPortalItem
[New] Display web scene from portal item
2 parents bc0b747 + fbf454c commit fc11595

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed

Samples.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@
198198
D73FC0FE2AD4A19A0067A19B /* CreateMobileGeodatabaseView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D73FC0FC2AD4A18D0067A19B /* CreateMobileGeodatabaseView.swift */; };
199199
D73FCFFF2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73FCFFE2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift */; };
200200
D73FD0002B02C9610006360D /* FindRouteAroundBarriersView.Views.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D73FCFFE2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift */; };
201+
D742E4922B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D742E48F2B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift */; };
202+
D742E4952B04134C00690098 /* DisplayWebSceneFromPortalItemView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D742E48F2B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift */; };
201203
D744FD172A2112D90084A66C /* CreateConvexHullAroundPointsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D744FD162A2112D90084A66C /* CreateConvexHullAroundPointsView.swift */; };
202204
D744FD182A2113C70084A66C /* CreateConvexHullAroundPointsView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D744FD162A2112D90084A66C /* CreateConvexHullAroundPointsView.swift */; };
203205
D7464F1E2ACE04B3007FEE88 /* IdentifyRasterCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7464F1D2ACE04B3007FEE88 /* IdentifyRasterCellView.swift */; };
@@ -376,6 +378,7 @@
376378
dstPath = "";
377379
dstSubfolderSpec = 7;
378380
files = (
381+
D742E4952B04134C00690098 /* DisplayWebSceneFromPortalItemView.swift in Copy Source Code Files */,
379382
D7010EC12B05618400D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Copy Source Code Files */,
380383
D737237B2AF5AE1A00846884 /* FindRouteInMobileMapPackageView.Models.swift in Copy Source Code Files */,
381384
D737237A2AF5AE1600846884 /* FindRouteInMobileMapPackageView.MobileMapView.swift in Copy Source Code Files */,
@@ -623,6 +626,7 @@
623626
D73F8CF32AB1089900CD39DA /* Restaurant.stylx */ = {isa = PBXFileReference; lastKnownFileType = file; path = Restaurant.stylx; sourceTree = "<group>"; };
624627
D73FC0FC2AD4A18D0067A19B /* CreateMobileGeodatabaseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateMobileGeodatabaseView.swift; sourceTree = "<group>"; };
625628
D73FCFFE2B02C7630006360D /* FindRouteAroundBarriersView.Views.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindRouteAroundBarriersView.Views.swift; sourceTree = "<group>"; };
629+
D742E48F2B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayWebSceneFromPortalItemView.swift; sourceTree = "<group>"; };
626630
D744FD162A2112D90084A66C /* CreateConvexHullAroundPointsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateConvexHullAroundPointsView.swift; sourceTree = "<group>"; };
627631
D7464F1D2ACE04B3007FEE88 /* IdentifyRasterCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdentifyRasterCellView.swift; sourceTree = "<group>"; };
628632
D7464F2A2ACE0964007FEE88 /* SA_EVI_8Day_03May20 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = SA_EVI_8Day_03May20; sourceTree = "<group>"; };
@@ -830,6 +834,7 @@
830834
1C56B5DE2A82C02D000381DA /* Display points using clustering feature reduction */,
831835
E004A6D528465C70002A1FE6 /* Display scene */,
832836
D7010EBA2B05616900D43F55 /* Display scene from mobile scene package */,
837+
D742E48E2B04132B00690098 /* Display web scene from portal item */,
833838
E070A0A1286F3B3400F2B606 /* Download preplanned map area */,
834839
E004A6EE284E4B7A002A1FE6 /* Download vector tiles to local cache */,
835840
1C26ED122A859525009B7721 /* Filter features in scene */,
@@ -1407,6 +1412,14 @@
14071412
path = "Create mobile geodatabase";
14081413
sourceTree = "<group>";
14091414
};
1415+
D742E48E2B04132B00690098 /* Display web scene from portal item */ = {
1416+
isa = PBXGroup;
1417+
children = (
1418+
D742E48F2B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift */,
1419+
);
1420+
path = "Display web scene from portal item";
1421+
sourceTree = "<group>";
1422+
};
14101423
D744FD132A2112360084A66C /* Create convex hull around points */ = {
14111424
isa = PBXGroup;
14121425
children = (
@@ -2235,6 +2248,7 @@
22352248
E0EA0B772866390E00C9621D /* ProjectGeometryView.swift in Sources */,
22362249
D74C8BFE2ABA5605007C76B8 /* StyleSymbolsFromMobileStyleFileView.swift in Sources */,
22372250
D7E7D0812AEB39D5003AAD02 /* FindRouteInTransportNetworkView.swift in Sources */,
2251+
D742E4922B04132B00690098 /* DisplayWebSceneFromPortalItemView.swift in Sources */,
22382252
0042E24328E4BF8F001F33D6 /* ShowViewshedFromPointInSceneView.Model.swift in Sources */,
22392253
D7E557682A1D768800B9FB09 /* AddWMSLayerView.swift in Sources */,
22402254
D7497F3C2AC4B4C100167AD2 /* DisplayDimensionsView.swift in Sources */,
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2023 Esri
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import ArcGIS
16+
import SwiftUI
17+
18+
struct DisplayWebSceneFromPortalItemView: View {
19+
/// A scene of Geneva, Switzerland created from a portal item.
20+
@State private var scene = {
21+
// Create a portal item using a portal and an ID.
22+
let portalItem = PortalItem(
23+
portal: .arcGISOnline(connection: .anonymous),
24+
id: .genevaSwitzerlandScene
25+
)
26+
27+
// Create a scene using the portal item.
28+
return Scene(item: portalItem)
29+
}()
30+
31+
var body: some View {
32+
// Create a scene view with the scene.
33+
SceneView(scene: scene)
34+
}
35+
}
36+
37+
private extension PortalItem.ID {
38+
/// The ID for the "Geneva, Switzerland Scene" portal item on ArcGIS Online.
39+
static var genevaSwitzerlandScene: PortalItem.ID {
40+
.init("c6f90b19164c4283884361005faea852")!
41+
}
42+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Display web scene from portal item
2+
3+
Open a web scene from a portal item.
4+
5+
![Image of display web scene from portal item](display-web-scene-from-portal-item.png)
6+
7+
## Use case
8+
9+
A scene is symbolized geospatial content that allows you to visualize and analyze geographic information in an intuitive and interactive 3D environment. Web scenes are an ArcGIS format for storing scenes in ArcGIS Online or portal. Scenes can be used to visualize a complex 3D environment like a city.
10+
11+
## How to use the sample
12+
13+
When the sample opens, it will automatically display the scene from ArcGIS Online. Pan and zoom to explore the scene.
14+
15+
## How it works
16+
17+
To open a web scene from a portal item:
18+
19+
1. Create a `PortalItem` with an item ID pointing to a web scene.
20+
2. Create a `Scene` passing in the portal item.
21+
3. Pass the scene to a `SceneView` to display it.
22+
23+
## Relevant API
24+
25+
* PortalItem
26+
* Scene
27+
* SceneView
28+
29+
## About the data
30+
31+
This sample uses a [Geneva, Switzerland Scene](https://www.arcgis.com/home/item.html?id=c6f90b19164c4283884361005faea852) hosted on ArcGIS Online.
32+
33+
## Tags
34+
35+
portal, scene, web scene
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"category": "Scenes",
3+
"description": "Open a web scene from a portal item.",
4+
"ignore": false,
5+
"images": [
6+
"display-web-scene-from-portal-item.png"
7+
],
8+
"keywords": [
9+
"portal",
10+
"scene",
11+
"web scene",
12+
"PortalItem",
13+
"Scene",
14+
"SceneView"
15+
],
16+
"redirect_from": [],
17+
"relevant_apis": [
18+
"PortalItem",
19+
"Scene",
20+
"SceneView"
21+
],
22+
"snippets": [
23+
"DisplayWebSceneFromPortalItemView.swift"
24+
],
25+
"title": "Display web scene from portal item"
26+
}
187 KB
Loading

0 commit comments

Comments
 (0)