<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create WMTS layer in SwiftUI SDK in Swift Maps SDK Questions</title>
    <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1327398#M142</link>
    <description>&lt;P&gt;After some more discussion with Matvei, we think this might be a bug in our API and we need to look further.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Meanwhile,&lt;/P&gt;&lt;P&gt;1. This code can display the basemap correctly. Note a few things: the layer ID can be obtained from the XML doc; you'll need to set the token both on the "GetCapabilities" endpoint (the bug we are looking into), and the custom parameters, to ensure both the endpoint and further request are correctly authenticated.&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;let url = URL(string: "https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0&amp;amp;maxar_api_token=*****")!
let wmtsLayer = WMTSLayer(url: url, layerID: "Maxar:Imagery")
wmtsLayer.setCustomParameterValue("*****", forKey: "maxar_api_token")
return Map(basemap: Basemap(baseLayer: wmtsLayer))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;2. Alternatively, you can create an WMTSService and use it to construct the layer, such as&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;let service = WMTSService(url: URL(string: "https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0")!)
service.setCustomParameterValue("*****", forKey: "maxar_api_token")
try? await service.load()
let wmtsLayer = WMTSLayer(layerInfo: service.serviceInfo!.layerInfos[1])
map = Map(basemap: Basemap(baseLayer: wmtsLayer))&lt;/LI-CODE&gt;&lt;P&gt;In this way, the service is authenticated with the API token so all further requests are valid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if it solves your problem.&lt;/P&gt;&lt;P&gt;p.s. apologies for the delayed response. It took us a while to figure out how to get a Maxar API token… &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2023 18:23:25 GMT</pubDate>
    <dc:creator>Ting</dc:creator>
    <dc:date>2023-09-11T18:23:25Z</dc:date>
    <item>
      <title>How to create WMTS layer in SwiftUI SDK</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1320451#M116</link>
      <description>&lt;P&gt;I was successful adding a WMTS layer to my ArcGIS online map, streaming imagery. &amp;nbsp; However, I attempted to mimic the setup in SwiftUI SDK with no luck.&lt;/P&gt;&lt;P&gt;In ArcGIS Online:&lt;BR /&gt;1. &amp;nbsp;I added a new item: &amp;nbsp;URL -&amp;gt; ....WMTS....&lt;/P&gt;&lt;P&gt;2. Added the URL: &amp;nbsp;&lt;A href="https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0" target="_blank" rel="noopener"&gt;https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;3. &amp;nbsp;Custom parameter: &amp;nbsp;maxar_api_token, &amp;lt;token&amp;gt;&lt;/P&gt;&lt;P&gt;4. &amp;nbsp;Select a layer to add: &amp;nbsp;Imagery, &amp;nbsp;Matrix tile: &amp;nbsp;EPSG:3857&lt;/P&gt;&lt;P&gt;5. &amp;nbsp;Success&lt;/P&gt;&lt;P&gt;However, in iOS, not able to get the same results:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;import&lt;/STRONG&gt;&lt;/SPAN&gt; SwiftUI&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;import&lt;/STRONG&gt;&lt;/SPAN&gt; ArcGIS&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;struct&lt;/STRONG&gt;&lt;/SPAN&gt; OverlayImagesView&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;View&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;@State&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;private&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;var&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;map&lt;/SPAN&gt;: Map = {&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; map = Map(basemapStyle: .arcGISStreets)&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;map.initialViewpoint = Viewpoint(&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;latitude: &lt;SPAN&gt;39&lt;/SPAN&gt;, longitude: -&lt;SPAN&gt;98&lt;/SPAN&gt;, scale: &lt;SPAN&gt;4e7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; url = &lt;/SPAN&gt;&lt;SPAN&gt;URL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;"&lt;A href="https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0" target="_blank" rel="noopener"&gt;https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0&lt;/A&gt;"&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;var&lt;/STRONG&gt;&lt;/SPAN&gt; wmtsLayer = WMTSLayer(url: url!, layerID: &lt;SPAN&gt;"Imagery"&lt;/SPAN&gt;, tileMatrixSetID: &lt;SPAN&gt;"EPSG:3857"&lt;/SPAN&gt;, preferredImageFormat: TileImageFormat.png)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;wmtsLayer.setCustomParameterValue(&lt;/SPAN&gt;"***********************"&lt;SPAN&gt;, forKey: &lt;/SPAN&gt;"maxar_api_token"&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;map.addOperationalLayer(wmtsLayer)&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;return&lt;/STRONG&gt;&lt;/SPAN&gt; map&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}()&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;var&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;body&lt;/SPAN&gt;: &lt;SPAN&gt;&lt;STRONG&gt;some&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;View&lt;/SPAN&gt; {&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;MapView(map: &lt;SPAN&gt;map&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Builds and runs successfully but just shows basemap at all zoom levels&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2023 04:44:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1320451#M116</guid>
      <dc:creator>bux225</dc:creator>
      <dc:date>2023-08-20T04:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create WMTS layer in SwiftUI SDK</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1320819#M117</link>
      <description>&lt;P&gt;Hi, welcome to Esri Community! I'm not a subject-matter expert on this topic so I reached out to our OGC team and they may share more details later after getting a Maxar API token.&lt;/P&gt;&lt;P&gt;Meanwhile, I'm wondering if it is related to spatial reference. Consider this snippet. When I create a map with WGS 84 SR, the demo WMTS service from NASA displays just fine. While if I use the default Web Mercator SR, the layer doesn't display. Could it be similar to your situation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;import SwiftUI
import ArcGIS

struct ContentView: View {
    @State private var map: Map = {
        // Esri WGS84 Topo basemap.
        let map = Map(
            item: PortalItem(
                portal: .arcGISOnline(connection: .anonymous),
                id: PortalItem.ID("6b4764e99107496f9193e4b68a77b73a")!
            )
        )
        let url = URL(string: "https://map1.vis.earthdata.nasa.gov/wmts-geo/1.0.0/WMTSCapabilities.xml")!
        let wmtsLayer = WMTSLayer(url: url, layerID: "AMSR2_Wind_Speed_Day")
        map.addOperationalLayer(wmtsLayer)
        return map
    }()
    
    @State private var mapWebMercator: Map = {
        let map = Map(basemapStyle: .arcGISTopographic)
        let url = URL(string: "https://map1.vis.earthdata.nasa.gov/wmts-geo/1.0.0/WMTSCapabilities.xml")!
        let wmtsLayer = WMTSLayer(url: url, layerID: "AMSR2_Wind_Speed_Day")
        map.addOperationalLayer(wmtsLayer)
        return map
    }()

    var body: some View {
        MapView(map: map)  // mapWebMercator
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;p.s. when adding a code snippet in this forum, you can click the ellipsis button in the editor and use "Insert/Edit code example" button to make it code highlighted &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 17:36:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1320819#M117</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2023-08-21T17:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create WMTS layer in SwiftUI SDK</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1322823#M136</link>
      <description>&lt;P&gt;Much appreciated. &amp;nbsp;Gave your idea a try but no luck&lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2023 22:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1322823#M136</guid>
      <dc:creator>bux225</dc:creator>
      <dc:date>2023-08-27T22:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create WMTS layer in SwiftUI SDK</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1323067#M137</link>
      <description>&lt;P&gt;I've asked for help from&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/256344"&gt;@MatveiStefarov&lt;/a&gt;&amp;nbsp;. He's looking into the Maxar service.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 17:09:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1323067#M137</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2023-08-28T17:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create WMTS layer in SwiftUI SDK</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1323819#M138</link>
      <description>&lt;P&gt;Hello!&amp;nbsp; I tested this Maxar WMTS service, specifically the "Imagery" layer with EPSG:3857 tile matrix.&amp;nbsp; I was able to use it in both SceneViews and MapViews:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2023-08-29_151159 WmtsTest.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79450iD7838F654A653BD3/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-08-29_151159 WmtsTest.png" alt="2023-08-29_151159 WmtsTest.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If nothing from the WMTS service is showing, try checking the &lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/layer/loadstatus" target="_self"&gt;loadStatus&lt;/A&gt; on the layer, and &lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/layerviewstate/status-swift.struct" target="_self"&gt;layerViewState&lt;/A&gt; on the MapView.&amp;nbsp; You may find additional information there -- let us know if you spot any error messages or warnings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, it looks like layers in this WMTS service are meant to be used as base layers, rather than an operational layer.&amp;nbsp; They are opaque tiled layers with global coverage, so they would completely cover up your &lt;SPAN&gt;arcGISStreets &lt;/SPAN&gt;basemap.&amp;nbsp; You can create a custom basemap from this layer using&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/basemap/init(baselayer:)" target="_self"&gt;init(baseLayer:)&lt;/A&gt;&amp;nbsp;and use it for your Map instead&lt;SPAN&gt;.&amp;nbsp; Your other operational layers should now display on top of Maxar imagery.&amp;nbsp; You can also add a reference layer to your custom basemap.&amp;nbsp; For example, here I added an&amp;nbsp;ArcGISVectorTiledLayer created from&amp;nbsp;&lt;A href="https://www.arcgis.com/home/item.html?id=f240fe360b434afc87dd989bf0c0b825" target="_self"&gt;OSM Hybrid Reference&lt;/A&gt;&amp;nbsp;to the basemap's &lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/basemap/referencelayers" target="_self"&gt;referenceLayers&lt;/A&gt;.&amp;nbsp; It looked like this when I zoomed in:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2023-08-30_031009 WmtsTest.png" style="width: 655px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79452i7C0F6E7D862C1346/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-08-30_031009 WmtsTest.png" alt="2023-08-30_031009 WmtsTest.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 10:15:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1323819#M138</guid>
      <dc:creator>MatveiStefarov</dc:creator>
      <dc:date>2023-08-30T10:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create WMTS layer in SwiftUI SDK</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1325617#M141</link>
      <description>&lt;P&gt;Thanks Matvei. &amp;nbsp; Do you have this running in iOS? &amp;nbsp;I'm getting notloaded for load status&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 20:30:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1325617#M141</guid>
      <dc:creator>bux225</dc:creator>
      <dc:date>2023-09-05T20:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create WMTS layer in SwiftUI SDK</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1327398#M142</link>
      <description>&lt;P&gt;After some more discussion with Matvei, we think this might be a bug in our API and we need to look further.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Meanwhile,&lt;/P&gt;&lt;P&gt;1. This code can display the basemap correctly. Note a few things: the layer ID can be obtained from the XML doc; you'll need to set the token both on the "GetCapabilities" endpoint (the bug we are looking into), and the custom parameters, to ensure both the endpoint and further request are correctly authenticated.&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;let url = URL(string: "https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0&amp;amp;maxar_api_token=*****")!
let wmtsLayer = WMTSLayer(url: url, layerID: "Maxar:Imagery")
wmtsLayer.setCustomParameterValue("*****", forKey: "maxar_api_token")
return Map(basemap: Basemap(baseLayer: wmtsLayer))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;2. Alternatively, you can create an WMTSService and use it to construct the layer, such as&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;let service = WMTSService(url: URL(string: "https://api.maxar.com/streaming/v1/ogc/gwc/service/wmts?service=WMTS&amp;amp;request=GetCapabilities&amp;amp;version=1.0.0")!)
service.setCustomParameterValue("*****", forKey: "maxar_api_token")
try? await service.load()
let wmtsLayer = WMTSLayer(layerInfo: service.serviceInfo!.layerInfos[1])
map = Map(basemap: Basemap(baseLayer: wmtsLayer))&lt;/LI-CODE&gt;&lt;P&gt;In this way, the service is authenticated with the API token so all further requests are valid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if it solves your problem.&lt;/P&gt;&lt;P&gt;p.s. apologies for the delayed response. It took us a while to figure out how to get a Maxar API token… &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 18:23:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/how-to-create-wmts-layer-in-swiftui-sdk/m-p/1327398#M142</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2023-09-11T18:23:25Z</dc:date>
    </item>
  </channel>
</rss>

