I'm kinda lost here.
I basically just want to add a Layer for basemap.at - see here: https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml
How do I do this? Do I use ArcGISTiledLAyer? ArcGISMapImageLayer? Which Uri?
The only documentation about WMTS I found was a "PortalItemType". If I need a "ArcGISPortal", what should I use as an Uri here?
Actually OpenStreetMap didn't make it either. However here's a custom tiled layer that renders OSM. You can probably tweak it to work for your WMTS service.
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">OpenStreetMapLayer</SPAN> <SPAN class="punctuation token">:</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>Mapping<SPAN class="punctuation token">.</SPAN>ServiceImageTiledLayer <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">public</SPAN> <SPAN class="token function">OpenStreetMapLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">base</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">CreateTileInfo</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Envelope</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">20037508.3427892</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">20037508.3427892</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">20037508.3427892</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">20037508.3427892</SPAN><SPAN class="punctuation token">,</SPAN> SpatialReferences<SPAN class="punctuation token">.</SPAN>WebMercator<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">static</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>ArcGISServices<SPAN class="punctuation token">.</SPAN>TileInfo <SPAN class="token function">CreateTileInfo</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> levels <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>ArcGISServices<SPAN class="punctuation token">.</SPAN>LevelOfDetail</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">19</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">double</SPAN> resolution <SPAN class="operator token">=</SPAN> <SPAN class="number token">20037508.3427892</SPAN> <SPAN class="operator token">*</SPAN> <SPAN class="number token">2</SPAN> <SPAN class="operator token">/</SPAN> <SPAN class="number token">256</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">double</SPAN> scale <SPAN class="operator token">=</SPAN> resolution <SPAN class="operator token">*</SPAN> <SPAN class="number token">96</SPAN> <SPAN class="operator token">*</SPAN> <SPAN class="number token">39.37</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">int</SPAN> i <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN> i <SPAN class="operator token"><</SPAN> levels<SPAN class="punctuation token">.</SPAN>Length<SPAN class="punctuation token">;</SPAN> i<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> levels<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>ArcGISServices<SPAN class="punctuation token">.</SPAN>LevelOfDetail</SPAN><SPAN class="punctuation token">(</SPAN>i<SPAN class="punctuation token">,</SPAN> resolution<SPAN class="punctuation token">,</SPAN> scale<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> resolution <SPAN class="operator token">/</SPAN><SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> scale <SPAN class="operator token">/</SPAN><SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>ArcGISServices<SPAN class="punctuation token">.</SPAN>TileInfo</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">96</SPAN><SPAN class="punctuation token">,</SPAN> TileImageFormat<SPAN class="punctuation token">.</SPAN>Png<SPAN class="punctuation token">,</SPAN> levels<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MapPoint</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">20037508.3427892</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">20037508.3427892</SPAN><SPAN class="punctuation token">,</SPAN> SpatialReferences<SPAN class="punctuation token">.</SPAN>WebMercator<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> SpatialReferences<SPAN class="punctuation token">.</SPAN>WebMercator<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">256</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">256</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">static</SPAN> <SPAN class="keyword token">string</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN> subdomains <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"a"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"b"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"c"</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">protected</SPAN> <SPAN class="keyword token">override</SPAN> Task<SPAN class="operator token"><</SPAN>Uri<SPAN class="operator token">></SPAN> <SPAN class="token function">GetTileUriAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">int</SPAN> level<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">int</SPAN> row<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">int</SPAN> column<SPAN class="punctuation token">,</SPAN> CancellationToken cancellationToken<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">return</SPAN> Task<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FromResult</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>$<SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2F" target="_blank">http://</A><SPAN>{ subdomains[(level + column + row) % subdomains.Length]}.tile.openstreetmap.org/{level}/{column}/{row}.png"</SPAN></SPAN><SPAN class="punctuation token">,</SPAN> UriKind<SPAN class="punctuation token">.</SPAN>Absolute<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
You can find WMTS samples right here: https://github.com/Esri/arcgis-runtime-samples-dotnet/tree/master/src/WPF/ArcGISRuntime.WPF.Samples/Samples/Layers/WMTSLayer
Hi Parh,
WmtsLayer (WmtsLayer Class) is introduced in 100.1 to display WMTS layer. If you have downloaded the sample, there is an example how to consume the WMTS service using Runtime .net application.
Hope that helps,
Nagma
with version 100.1.0 of the SDK for .Net, support for WMTS is supposed to be here as mentioned in the release notes.
However, I could still find no documentation on this.
How do I take in a WMTS map? I was using 10.2.4 previously, I had hoped to do something like that...
here is the code in order to show wmts tiles
<SPAN class="keyword token">protected</SPAN> <SPAN class="keyword token">override</SPAN> Task<SPAN class="operator token"><</SPAN>Uri<SPAN class="operator token">></SPAN> <SPAN class="token function">GetTileUriAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">int</SPAN> level<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">int</SPAN> row<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">int</SPAN> column<SPAN class="punctuation token">,</SPAN> CancellationToken cancellationToken<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> row <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">int</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">(</SPAN>Math<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Pow</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">,</SPAN> level<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN> row <SPAN class="operator token">-</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">string</SPAN> uriString <SPAN class="operator token">=</SPAN> tilesUri <SPAN class="operator token">+</SPAN> $<SPAN class="string token">"/{level}/{column}/{row}.png"</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">return</SPAN> Task<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FromResult</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>uriString<SPAN class="punctuation token">,</SPAN> UriKind<SPAN class="punctuation token">.</SPAN>Absolute<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
This works, thank you!
You don't happen to have a similar workaround/implementation for ServiceFeatureTable from WMS?
Is there no workaround for adding a single layer?
I was told, the SDK supports "Open Street Map", which uses the same protocol as basemap.at.
WMTS support is not available in the released version but it's up on the list for next release.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.