Select to view content in your preferred language

How to load a web map from URL into ArcGIS SDK fro MacOS in Swift

801
0
04-01-2017 08:28 AM
HenryHunt1
New Contributor

I'm trying to load OpenStreetMap into a program I'm writing in Swift, using the ArcGIS SDK for macOS. I have the loading of built in maps (theMap.map = AGSMap(basemap: AGSBasemap.imagery())) working but I cannot seem to load OpenStreetMap from its URL.

This is the URL I am using: https://www.arcgis.com/home/item.html?id=b834a68d7a484c5fb473d4ba90d35e71

I am using this code but it does not work:

let tiledLayer = AGSArcGISTiledLayer(url: URL(string: "https://www.arcgis.com/home/item.html?id=b834a68d7a484c5fb473d4ba90d35e71/MapServer")!)

let basemap = AGSBasemap(baseLayer: tiledLayer)
theMap.map?.basemap = basemap

I am completely out of ideas and have no idea what to do. All I want to do is display the OpenStreetMap from the URL in my map, how can I do it? Thanks.

0 Kudos
0 Replies