Skip to content

Commit fdb1573

Browse files
committed
Add sources for 3D tiles layer.
1 parent 2f611f6 commit fdb1573

File tree

4 files changed

+125
-0
lines changed

4 files changed

+125
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright 2024 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 Add3DTilesLayerView: View {
19+
/// A scene with dark gray basemap and an OGC 3D tiles layer.
20+
@State private var scene: ArcGIS.Scene = {
21+
// Creates a scene and sets an initial viewpoint.
22+
let scene = Scene(basemapStyle: .arcGISDarkGray)
23+
let camera = Camera(
24+
latitude: 48.84553,
25+
longitude: 9.16275,
26+
altitude: 350,
27+
heading: 0,
28+
pitch: 75,
29+
roll: 0
30+
)
31+
scene.initialViewpoint = Viewpoint(boundingGeometry: camera.location, camera: camera)
32+
33+
// Creates a surface and adds an elevation source.
34+
let surface = Surface()
35+
surface.addElevationSource(ArcGISTiledElevationSource(url: .worldElevationService))
36+
37+
// Sets the surface to the scene's base surface.
38+
scene.baseSurface = surface
39+
40+
// Adds a OGC 3D tiles layer from a URL to the scene's operational layers.
41+
scene.addOperationalLayer(OGC3DTilesLayer(url: .stuttgart3DTiles))
42+
return scene
43+
}()
44+
45+
var body: some View {
46+
SceneView(scene: scene)
47+
}
48+
}
49+
50+
private extension URL {
51+
/// The URL of a Stuttgart, Germany city scene service.
52+
static var stuttgart3DTiles: URL {
53+
URL(string: "https://tiles.arcgis.com/tiles/N82JbI5EYtAkuUKU/arcgis/rest/services/Stuttgart/3DTilesServer/tileset.json")!
54+
}
55+
56+
/// The URL of the Terrain 3D ArcGIS REST Service.
57+
static var worldElevationService: URL {
58+
URL(string: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")!
59+
}
60+
}
61+
62+
#Preview {
63+
Add3DTilesLayerView()
64+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Add 3d tiles layer
2+
3+
Add a layer to visualize 3D tiles data that conforms to the OGC 3D Tiles specification.
4+
5+
![Image of Add 3D tiles layer sample](add-3d-tiles-layer.png)
6+
7+
## Use case
8+
9+
One possible use case is that when added to a scene, a 3D tiles layer can assist in performing visual analysis, such as line of sight analysis. A line of sight analysis can be used to assess whether a view is obstructed between an observer and a target.
10+
11+
## How to use the sample
12+
13+
When loaded, the sample will display a scene with an `OGC3DTilesLayer`. Pan around and zoom in to observe the scene of the `Ogc3DTilesLayer`. Notice how the layer's level of detail changes as you zoom in and out from the layer.
14+
15+
## How it works
16+
17+
1. Create a scene.
18+
2. Create an `OGC3DTilesLayer` with the URL to a 3D tiles layer service.
19+
3. Add the layer to the scene's operational layers.
20+
21+
## Relevant API
22+
23+
* OGC3DTilesLayer
24+
* SceneView
25+
26+
## About the data
27+
28+
A layer to visualize 3D tiles data that conforms to the OGC 3D Tiles specification. As of ArcGIS Maps SDK for Swift 200.4, it supports analyses like viewshed and line of sight, but does not support other operations like individual feature identification.
29+
30+
The 3D Tiles Open Geospatial Consortium (OGC) specification defines a spatial data structure and a set of tile formats designed for streaming and rendering 3D geospatial content. A 3D Tiles data set, known as a tileset, defines one or more tile formats organized into a hierarchical spatial data structure. For more information, see the [OGC 3D Tiles specification](https://www.ogc.org/standard/3DTiles).
31+
32+
## Tags
33+
34+
3d tiles, layers, OGC, OGC API, scene, service
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"category": "Scenes",
3+
"description": "Add a layer to visualize 3D tiles data that conforms to the OGC 3D Tiles specification.",
4+
"ignore": false,
5+
"images": [
6+
"add-3d-tiles-layer.png"
7+
],
8+
"keywords": [
9+
"3d tiles",
10+
"OGC",
11+
"OGC API",
12+
"layers",
13+
"scene",
14+
"service",
15+
"OGC3DTilesLayer",
16+
"SceneView"
17+
],
18+
"redirect_from": [],
19+
"relevant_apis": [
20+
"OGC3DTilesLayer",
21+
"SceneView"
22+
],
23+
"snippets": [
24+
"Add3DTilesLayerView.swift"
25+
],
26+
"title": "Add 3d tiles layer"
27+
}
75.9 KB
Loading

0 commit comments

Comments
 (0)