<?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 Add wms layer first in selected spatial reference  in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/add-wms-layer-first-in-selected-spatial-reference/m-p/565979#M6941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to add firstly WmsLayer and than FeatureLayer.&lt;/P&gt;&lt;P&gt;Wms layer suports more than one spatial reference (4326, 3857, 2180).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I do it in order: wms, feature mapView is set to work in 4326,&lt;BR /&gt;but whan i firsty add featureLayer in 3857 and than wms layer mapView is set to 3857.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to have 3857 at mapview. Setting spatial reference to mapview.map do not change anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know is there any way to force wms layer to open in selected spatial reference ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Mar 2016 11:00:52 GMT</pubDate>
    <dc:creator>RobertDawidziuk</dc:creator>
    <dc:date>2016-03-09T11:00:52Z</dc:date>
    <item>
      <title>Add wms layer first in selected spatial reference</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-wms-layer-first-in-selected-spatial-reference/m-p/565979#M6941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to add firstly WmsLayer and than FeatureLayer.&lt;/P&gt;&lt;P&gt;Wms layer suports more than one spatial reference (4326, 3857, 2180).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I do it in order: wms, feature mapView is set to work in 4326,&lt;BR /&gt;but whan i firsty add featureLayer in 3857 and than wms layer mapView is set to 3857.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to have 3857 at mapview. Setting spatial reference to mapview.map do not change anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know is there any way to force wms layer to open in selected spatial reference ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2016 11:00:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-wms-layer-first-in-selected-spatial-reference/m-p/565979#M6941</guid>
      <dc:creator>RobertDawidziuk</dc:creator>
      <dc:date>2016-03-09T11:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Add wms layer first in selected spatial reference</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-wms-layer-first-in-selected-spatial-reference/m-p/565980#M6942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to set both the SpatialReference and the Extent which can be done via the InitialViewpoint property on the Map. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2016 19:43:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-wms-layer-first-in-selected-spatial-reference/m-p/565980#M6942</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2016-03-11T19:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Add wms layer first in selected spatial reference</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-wms-layer-first-in-selected-spatial-reference/m-p/565981#M6943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for tip, I check it many times but it does not work,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. code sample:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private async Task WmsWaw()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpatialReference sr = new SpatialReference(2180);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.MyMapView.Map = new Map()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpatialReference = sr
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };


&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Esri.ArcGISRuntime.Layers.WmsLayer wms = new Esri.ArcGISRuntime.Layers.WmsLayer(new Uri("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fwms.um.warszawa.pl%2Fserwis" target="_blank"&gt;http://wms.um.warszawa.pl/serwis&lt;/A&gt;&lt;SPAN&gt;"));&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; await wms.InitializeAsync();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string name = "WMS/Raster_orto2010_10cm";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wms.Layers = new List&amp;lt;string&amp;gt;() { name };


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var nameLayerInfo = wms.ServiceInfo.RootLayer.ChildLayers.FirstOrDefault(l =&amp;gt; l.Name == name);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.MyMapView.Map.Layers.Add(wms);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var extent = nameLayerInfo.Extent;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (nameLayerInfo.Extent.SpatialReference.Wkid != sr.Wkid)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extent = GeometryEngine.Project(nameLayerInfo.Extent, sr).Extent;


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.MyMapView.Map.InitialViewpoint = new Viewpoint(extent);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; await this.MyMapView.LayersLoadedAsync();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Spatial references:&lt;/P&gt;&lt;P&gt;Map 2180&lt;/P&gt;&lt;P&gt;MapView 4326&lt;/P&gt;&lt;P&gt;MapView Extent Envelope[XMin=21.0472112879068, YMin=52.222082410043, XMax=21.0491953019784, YMax=52.2232987533104, Wkid=4326]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so map stil works in 4326&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wms.warszawa.pl in root layer informs that supported spatial references is only 4326, child layers have more: 4326 and 2180&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. code sample &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private async Task AddGeoportal2()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpatialReference sr = new SpatialReference(2180);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.MyMapView.Map = new Map()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpatialReference = sr
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };


&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Esri.ArcGISRuntime.Layers.WmsLayer wms = new Esri.ArcGISRuntime.Layers.WmsLayer(new Uri("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fmapy.geoportal.gov.pl%2Fwss%2Fservice%2Fpub%2Fguest%2FG2_GO_WMS%2FMapServer%2FWMSServer" target="_blank"&gt;http://mapy.geoportal.gov.pl/wss/service/pub/guest/G2_GO_WMS/MapServer/WMSServer&lt;/A&gt;&lt;SPAN&gt;"));&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; await wms.InitializeAsync();


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ex = wms.ServiceInfo.RootLayer.Extent;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ex.SpatialReference.Wkid != sr.Wkid)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ex = GeometryEngine.Project(ex, sr).Extent;


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.MyMapView.Map.Layers.Add(wms);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.MyMapView.Map.InitialViewpoint = new Viewpoint(ex);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; await this.MyMapView.LayersLoadedAsync();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;although wms service in root layer has 2180 map still works in 4326&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. I think that you should allow to set expected spatialReference in wmsLayer, it should help in code sample 2&lt;/P&gt;&lt;P&gt;b. when you collect supported spatial refernces you should also take it from child layers, it should help in code sample 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;final efect is that I cant create map with wms layer, even though service return valid data in 2180 with feature layers in 2180&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I miss sth, or is other workaround ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:23:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-wms-layer-first-in-selected-spatial-reference/m-p/565981#M6943</guid>
      <dc:creator>RobertDawidziuk</dc:creator>
      <dc:date>2021-12-12T00:23:42Z</dc:date>
    </item>
  </channel>
</rss>

