ArcGIS tiled layers are designed for fast and simple access by web maps, web apps, ArcGIS, and nearly any mapping software application. For example, you might want to use a basemap with tiles of streets to provide a visual reference for trees in a city. Tile layers are also useful for exposing a map or layer for the visualization of relatively static data.
How to use the sample
Pan and zoom to explore the tiled layer basemap.
How it works
Construct an AGSArcGISTiledLayer with an ArcGIS Online service URL.
Add the layer instance to the map's operationalLayers array.
Relevant API
AGSArcGISTiledLayer
AGSMap
Tags
basemap, tiled layer, tiles
Sample Code
TLUsingURLViewController.swift
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2016 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//// http://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 UIKit
import ArcGIS
classTLUsingURLViewController: UIViewController{
@IBOutletprivateweakvar mapView: AGSMapView!
privatevar map: AGSMap!
overridefuncviewDidLoad() {
super.viewDidLoad()
// create a tiledLayer using url to a map serverlet tiledLayer =AGSArcGISTiledLayer(url: URL(string: "https://services.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer")!)
// initialize the map and add the tiled layer as an operational layerself.map =AGSMap()
self.map.operationalLayers.add(tiledLayer)
// assign the map to the map viewself.mapView.map =self.map
// add the source code button item to the right of navigation bar (self.navigationItem.rightBarButtonItem as!SourceCodeBarButtonItem).filenames = ["TLUsingURLViewController"]
}
}