Display a map with an imagery basemap.
Use case
The map is the fundamental building block of any GIS application and is used to specify how geographic data is organized and communicated to your users.
How to use the sample
When loaded, the sample will display a map. Pan and zoom to explore the map.
How it works
- Create a
Map
object with thearcGISImagery
basemap style. - Create a
MapView
instance with the map.
Relevant API
- BasemapStyle
- Map
- MapView
Tags
basemap style, map
Sample Code
DisplayMapView.swift
// Copyright 2022 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 DisplayMapView: View {
/// A map with imagery basemap.
@State private var map = Map(basemapStyle: .arcGISImagery)
var body: some View {
// Creates a map view to display the map.
MapView(map: map)
}
}
#Preview {
DisplayMapView()
}