<?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: Unable to show FeatureLayer using code behind in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542829#M6631</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Antti,&lt;/P&gt;&lt;P&gt;Glad you brought this up.&amp;nbsp; What is the difference when the ServiceFeatureTable is created from a dynamic map service (as in the example shown) verses ones from a feature service.&amp;nbsp; I've seen examples of ServiceFeatureTables created from both types of services, but never quite sure what the differences are.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 May 2016 17:13:24 GMT</pubDate>
    <dc:creator>HuyHo</dc:creator>
    <dc:date>2016-05-11T17:13:24Z</dc:date>
    <item>
      <title>Unable to show FeatureLayer using code behind</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542826#M6628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are having trouble loading FeatureLayers from the code behind.&amp;nbsp; We based our example on the FeatureLayerHitTesting sample using the following feature layer as a guide:&lt;/P&gt;&lt;P&gt;If we added the feature layer using XAML, the features would show up as expected:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:FeatureLayer ID="FeatureLayer"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:FeatureLayer.Renderer&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:SimpleRenderer&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:SimpleMarkerSymbol Color="LightBlue" Style="Circle" Size="12"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:SimpleMarkerSymbol.Outline&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:SimpleLineSymbol Color="Blue" Width="2" Style="Solid" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:SimpleMarkerSymbol.Outline&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:SimpleMarkerSymbol&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:SimpleRenderer&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:FeatureLayer.Renderer&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:FeatureLayer.FeatureTable&amp;gt;
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:ServiceFeatureTable ServiceUri="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fsampleserver6.arcgisonline.com%2Farcgis%2Frest%2Fservices%2FUSA%2FMapServer%2F0" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where="pop2000 &amp;gt; 200000" OutFields="*" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:FeatureLayer.FeatureTable&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:FeatureLayer&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture1.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/198363_Capture1.PNG" /&gt;&lt;/P&gt;&lt;P&gt;However, if we add the layer using code-behind, the layer would not display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; async void MyMapView_Loaded(object sender, RoutedEventArgs e)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Esri.ArcGISRuntime.Layers.FeatureLayer layer = new Esri.ArcGISRuntime.Layers.FeatureLayer();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServiceFeatureTable serviceTable = await ServiceFeatureTable.OpenAsync(
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Uri("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fsampleserver6.arcgisonline.com%2Farcgis%2Frest%2Fservices%2FUSA%2FMapServer%2F0" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0&lt;/A&gt;&lt;SPAN&gt;"));&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serviceTable.Where = "pop2000 &amp;gt; 200000";

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SimpleMarkerSymbol symbol = new SimpleMarkerSymbol
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Color = Colors.Orange,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Style = SimpleMarkerStyle.Circle,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size = 12,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Outline = new SimpleLineSymbol
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Color = Colors.Red,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Width = 2,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Style = SimpleLineStyle.Solid
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SimpleRenderer renderer = new SimpleRenderer();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; renderer.Symbol = symbol;


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer.Renderer = renderer;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer.FeatureTable = serviceTable;


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyMapView.Map.Layers.Add(layer);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But interestingly enough, we we try to added the same feature layer in both XAML and code behind, the code-behind layer would show up, but with a wrong projection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture2.PNG" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/198364_Capture2.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;What am I missing here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:30:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542826#M6628</guid>
      <dc:creator>HuyHo</dc:creator>
      <dc:date>2021-12-11T23:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to show FeatureLayer using code behind</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542827#M6629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update.&amp;nbsp; It seems the problem might had to do with the way the ServiceFeatureTable was created.&amp;nbsp; If I changed the code to use the constructor to obtain the service table instead of using OpenAsync(), it works.&amp;nbsp; Based on the description, OpenAsync() creates AND initializes the service (most likely in the spatial reference from the service), causing conflict in projection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServiceFeatureTable serviceTable = new ServiceFeatureTable(
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Uri("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fsampleserver6.arcgisonline.com%2Farcgis%2Frest%2Fservices%2FUSA%2FMapServer%2F0" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0&lt;/A&gt;&lt;SPAN&gt;"));&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serviceTable.Where = "pop2000 &amp;gt; 200000";&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:31:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542827#M6629</guid>
      <dc:creator>HuyHo</dc:creator>
      <dc:date>2021-12-11T23:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to show FeatureLayer using code behind</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542828#M6630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems that you are targeting dynamic service instead of feature service here. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 17:06:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542828#M6630</guid>
      <dc:creator>AnttiKajanus1</dc:creator>
      <dc:date>2016-05-11T17:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to show FeatureLayer using code behind</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542829#M6631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Antti,&lt;/P&gt;&lt;P&gt;Glad you brought this up.&amp;nbsp; What is the difference when the ServiceFeatureTable is created from a dynamic map service (as in the example shown) verses ones from a feature service.&amp;nbsp; I've seen examples of ServiceFeatureTables created from both types of services, but never quite sure what the differences are.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 17:13:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542829#M6631</guid>
      <dc:creator>HuyHo</dc:creator>
      <dc:date>2016-05-11T17:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to show FeatureLayer using code behind</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542830#M6632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Huy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;They're similar operations - both effectively executing a query and returning a featureset from which we create a ServiceFeatureTable. ServiceFeatureTables created from the MapServer/&amp;lt;Layer-ID&amp;gt; endpoint are not editable whereas ServiceFeatureTables created from the FeatureServer/&amp;lt;Layer-ID&amp;gt; endpoint may be editable, depending on the service configuration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more info see:&lt;/P&gt;&lt;P&gt;MapServer/Layer Query: &lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Query_Map_Service_Layer/02r3000000p1000000/" title="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Query_Map_Service_Layer/02r3000000p1000000/"&gt;ArcGIS REST API&lt;/A&gt;&lt;/P&gt;&lt;P&gt;FeatureServer/Layer Query: &lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Query_Feature_Service_Layer/02r3000000r1000000/" title="http://resources.arcgis.com/en/help/arcgis-rest-api/#/Query_Feature_Service_Layer/02r3000000r1000000/"&gt;ArcGIS REST API&lt;/A&gt;&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, 13 May 2016 23:55:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/unable-to-show-featurelayer-using-code-behind/m-p/542830#M6632</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2016-05-13T23:55:09Z</dc:date>
    </item>
  </channel>
</rss>

