Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New] Add map image layer #518

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Samples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@
D7DDF84E2AF43AA2004352D9 /* GeocodeOfflineView.Model.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D72C43F22AEB066D00B6157B /* GeocodeOfflineView.Model.swift */; };
D7DDF8532AF47C6C004352D9 /* FindRouteAroundBarriersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DDF8502AF47C6C004352D9 /* FindRouteAroundBarriersView.swift */; };
D7DDF8562AF47C86004352D9 /* FindRouteAroundBarriersView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7DDF8502AF47C6C004352D9 /* FindRouteAroundBarriersView.swift */; };
D7DFA0EA2CBA0242007C31F2 /* AddMapImageLayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DFA0E62CBA0242007C31F2 /* AddMapImageLayerView.swift */; };
D7DFA0ED2CBA0260007C31F2 /* AddMapImageLayerView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7DFA0E62CBA0242007C31F2 /* AddMapImageLayerView.swift */; };
D7E440D72A1ECE7D005D74DE /* CreateBuffersAroundPointsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E440D62A1ECE7D005D74DE /* CreateBuffersAroundPointsView.swift */; };
D7E440D82A1ECEB3005D74DE /* CreateBuffersAroundPointsView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7E440D62A1ECE7D005D74DE /* CreateBuffersAroundPointsView.swift */; };
D7E557682A1D768800B9FB09 /* AddWMSLayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E557672A1D768800B9FB09 /* AddWMSLayerView.swift */; };
Expand Down Expand Up @@ -545,6 +547,7 @@
dstPath = "";
dstSubfolderSpec = 7;
files = (
D7DFA0ED2CBA0260007C31F2 /* AddMapImageLayerView.swift in Copy Source Code Files */,
D7CDD38C2CB86F4A00DE9766 /* AddPointCloudLayerFromFileView.swift in Copy Source Code Files */,
95E0DBCA2C503E2500224A82 /* ShowDeviceLocationUsingIndoorPositioningView.swift in Copy Source Code Files */,
95E0DBCB2C503E2500224A82 /* ShowDeviceLocationUsingIndoorPositioningView.Model.swift in Copy Source Code Files */,
Expand Down Expand Up @@ -1001,6 +1004,7 @@
D7D1F3522ADDBE5D009CE2DA /* philadelphia.mspk */ = {isa = PBXFileReference; lastKnownFileType = file; path = philadelphia.mspk; sourceTree = "<group>"; };
D7D9FCF22BF2CC8600F972A2 /* FilterByDefinitionExpressionOrDisplayFilterView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FilterByDefinitionExpressionOrDisplayFilterView.swift; sourceTree = "<group>"; };
D7DDF8502AF47C6C004352D9 /* FindRouteAroundBarriersView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindRouteAroundBarriersView.swift; sourceTree = "<group>"; };
D7DFA0E62CBA0242007C31F2 /* AddMapImageLayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddMapImageLayerView.swift; sourceTree = "<group>"; };
D7E440D62A1ECE7D005D74DE /* CreateBuffersAroundPointsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateBuffersAroundPointsView.swift; sourceTree = "<group>"; };
D7E557672A1D768800B9FB09 /* AddWMSLayerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddWMSLayerView.swift; sourceTree = "<group>"; };
D7E7D0802AEB39D5003AAD02 /* FindRouteInTransportNetworkView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindRouteInTransportNetworkView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1167,6 +1171,7 @@
9537AFB52C2208CD000923C5 /* Add ENC exchange set */,
00D4EF7E2863840D00B9CC30 /* Add feature layers */,
D7F8C0342B60564D0072BFA7 /* Add features with contingent values */,
D7DFA0E92CBA0242007C31F2 /* Add map image layer */,
D7CDD3882CB86F0A00DE9766 /* Add point cloud layer from file */,
F19A316128906F0D003B7EF9 /* Add raster from file */,
955271622C0E6750009B1ED4 /* Add raster from service */,
Expand Down Expand Up @@ -2626,6 +2631,14 @@
path = "Find route around barriers";
sourceTree = "<group>";
};
D7DFA0E92CBA0242007C31F2 /* Add map image layer */ = {
isa = PBXGroup;
children = (
D7DFA0E62CBA0242007C31F2 /* AddMapImageLayerView.swift */,
);
path = "Add map image layer";
sourceTree = "<group>";
};
D7E440D12A1ECBC2005D74DE /* Create buffers around points */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3264,6 +3277,7 @@
0044CDDF2995C39E004618CE /* ShowDeviceLocationHistoryView.swift in Sources */,
E041ABC0287CA9F00056009B /* WebView.swift in Sources */,
D73E619E2BDB21F400457932 /* EditWithBranchVersioningView.swift in Sources */,
D7DFA0EA2CBA0242007C31F2 /* AddMapImageLayerView.swift in Sources */,
D7705D642AFC570700CC0335 /* FindClosestFacilityFromPointView.swift in Sources */,
E088E1572862579D00413100 /* SetSurfacePlacementModeView.swift in Sources */,
9579FCEA2C3360BB00FC8A1D /* EditFeatureAttachmentsView.swift in Sources */,
Expand Down
40 changes: 40 additions & 0 deletions Shared/Samples/Add map image layer/AddMapImageLayerView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2024 Esri
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import ArcGIS
import SwiftUI

struct AddMapImageLayerView: View {
/// A map with a map image layer of world elevations.
@State private var map: Map = {
// Creates the map image layer using a web URL.
let url = URL(string: "https://sampleserver5.arcgisonline.com/arcgis/rest/services/Elevation/WorldElevations/MapServer")!
let mapImageLayer = ArcGISMapImageLayer(url: url)

// Creates the map and adds the layer to the map's operational layers.
let map = Map()
map.addOperationalLayer(mapImageLayer)

return map
}()

var body: some View {
// Displays the map using a map view.
MapView(map: map)
}
}

#Preview {
AddMapImageLayerView()
}
27 changes: 27 additions & 0 deletions Shared/Samples/Add map image layer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Add map image layer

Display a layer from an ArcGIS map image layer service.

![Screenshot of Add map image layer sample](add-map-image-layer.png)

## Use case

Map image layers are also referred to as dynamic map services. These services generate images dynamically on the server and send the resulting image to the requesting client. This is useful when rendering complex cartography or large amounts of data in a connected environment, as the client simply displays the image that the server returns. This can result in more accurate and faster-performing layers.

## How to use the sample

Open the sample and view the map image layer. As you navigate the map, the layer issues image requests for the new map extent. The resulting images are rendered on the screen.

## How it works

1. Create a `Map`.
2. Create an `ArcGISMapImageLayer` with the URL to a map image service.
3. Add the layer to the map's `operationalLayers`.

## Relevant API

* ArcGISMapImageLayer

## Tags

display, image, layer, map
23 changes: 23 additions & 0 deletions Shared/Samples/Add map image layer/README.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"category": "Layers",
"description": "Display a layer from an ArcGIS map image layer service.",
"ignore": false,
"images": [
"add-map-image-layer.png"
],
"keywords": [
"display",
"image",
"layer",
"map",
"ArcGISMapImageLayer"
],
"redirect_from": [],
"relevant_apis": [
"ArcGISMapImageLayer"
],
"snippets": [
"AddMapImageLayerView.swift"
],
"title": "Add map image layer"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading