AnsweredAssumed Answered

Map from URL not loading despite working with URL of same format from the examples (ArcGIS macOS SDK)

Question asked by henryshunt on Feb 23, 2017

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 the following code to load the URL, taken from the ArcGIS Examples:

 

let openStreetMap = "https://www.arcgis.com/home/item.html?id=b834a68d7a484c5fb473d4ba90d35e71"

let tiles = AGSArcGISVectorTiledLayer(url: URL(string: openStreetMap)!)

theMap.map = AGSMap(basemap: AGSBasemap(baseLayer: tiles))

 

The map does not load and all I end up with is a grey gridded background. Surprisingly, if I swap the URL with one I found in the ArcGIS examples (https://www.arcgis.com/home/item.html?id=4e1133c28ac04cca97693cf336cd49ad), that map loads with no problems. The two URLs are in exactly the same format but only one works. Why is this and how can I get it to load the OpenStreetMap URL? Thanks.

Outcomes