<?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 a FeatureLayer based on a FeatureCollectionTable in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605158#M7422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wasn't involved in the design phase, but I suspect that this is down to&amp;nbsp;inheriting from FeatureTable (I'm not sure if the .NET API has OMDs so here's the one from the &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_table.html"&gt;iOS documentation&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="j-img-centered" height="233" src="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_table.png" style="color: #000000; display: block; margin-left: auto; margin-right: auto;" usemap="#AGSFeatureTable_map" width="822" /&gt;&lt;/P&gt;&lt;P&gt;I further suspect that to inherit&amp;nbsp;the properties of a FeatureTable without allowing the type model to accept it into the FeatureLayer constructor would involve some convoluted hierarchy and protocol designs&amp;nbsp;that might not even work well in&amp;nbsp;some SDKs. The solution&amp;nbsp;I can think of that would solve this through typing would really ugly up that diagram.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be fair, the error you get when you &lt;EM&gt;do&lt;/EM&gt; try isn't bad…&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;System.ArgumentException: 'Invalid argument: Cannot create a feature layer from a feature collection table. Add the feature collection table to a feature collection.'&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;…but I agree it could perhaps a little more usefully point you at the FeatureCollectionLayer as well&amp;nbsp;the FeatureCollection. I'll see if we can get that updated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 May 2019 12:03:27 GMT</pubDate>
    <dc:creator>Nicholas-Furness</dc:creator>
    <dc:date>2019-05-07T12:03:27Z</dc:date>
    <item>
      <title>How to create a FeatureLayer based on a FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605153#M7417</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;the Runtime documentation describes five constructor, which could be used to create a &lt;A href="https://developers.arcgis.com/net/latest/wpf/api-reference/html/T_Esri_ArcGISRuntime_Mapping_FeatureLayer.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;FeatureTable&lt;/A&gt;. One of them creates a class &lt;A href="https://developers.arcgis.com/net/latest/wpf/api-reference/html/M_Esri_ArcGISRuntime_Mapping_FeatureLayer__ctor_1.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;based on a FeatureTable&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Normally, a FeatureTable is based on a service, such as the ServiceFeatureTable, and is usually stored in a database. But I need a FeatureLayer on the fly based on in memory data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I thought in my case the FeatureCollectionTable would be the right way, because it is based on a FeatureTable&amp;nbsp;and so I should be able to create a FeatureLayer from it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code is compileable:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;List&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;Field&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Field&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;FieldType&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Text&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Field1"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Field1"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;FeatureCollectionTable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fields&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; GeometryType&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; SpatialReferences&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;WebMercator&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; featureLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;FeatureLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
MyMapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;OperationalLayers&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But when executing this code, I got an exception:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;System.ArgumentException: 'Invalid argument: Cannot create a feature layer from a feature collection table. Add the feature collection table to a feature collection.'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I'm a bit confused: Why can't I do that, a FeatureCollectionTable inherits from the FeatureTable?&lt;BR /&gt;Is that a bug? Is this work as designed?&lt;/P&gt;&lt;P&gt;A FeatureCollection doesn't get me where I want to be: Among other things, I want to be able to restrict data by DefinitionExpression, but this is only possible with the FeatureLayer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:57:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605153#M7417</guid>
      <dc:creator>MaximilianGlas</dc:creator>
      <dc:date>2021-12-12T01:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a FeatureLayer based on a FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605154#M7418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should use a Feature Collection Layer:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/net/latest/wpf/api-reference/html/T_Esri_ArcGISRuntime_Mapping_FeatureCollectionLayer.htm" title="https://developers.arcgis.com/net/latest/wpf/api-reference/html/T_Esri_ArcGISRuntime_Mapping_FeatureCollectionLayer.htm"&gt;FeatureCollectionLayer Class&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The layers property on it gives access to individual&amp;nbsp;FeatureLayers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A Feature Collection can include multiple tables, so when you instantiate&amp;nbsp;a Feature Collection Layer, you do so using&amp;nbsp;a Feature Collection, which is&amp;nbsp;instantiated using&amp;nbsp;the FeatureCollectionTable you created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See also &lt;A href="https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/2c920bccfdf7b1c439ea8c4b2a4c232ce1710265/src/Forms/Shared/Samples/Layers/CreateFeatureCollectionLayer/CreateFeatureCollectionLayer.xaml.cs#L102-L115"&gt;this sample&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 May 2019 22:42:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605154#M7418</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2019-05-06T22:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a FeatureLayer based on a FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605155#M7419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is adding just one of the sublayers of the FeatureCollectionLayer supported?&lt;/P&gt;&lt;P&gt;I changed the Create s New Feature Collection sample to add just the first sublayer and get an exception:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/445976_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 02:35:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605155#M7419</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-07T02:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a FeatureLayer based on a FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605156#M7420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't add the sublayers to the map's operational layers. They're already "owned" by&amp;nbsp;the FeatureCollectionLayer (hence the error you're seeing - the map can't take "ownership" as they already belong to something else). Instead, just add the FeatureCollectionLayer itself. In your case, it will only have one sublayer and you'll get the result you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case of the sample, simply don't add the other tables to the FeatureCollection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 04:13:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605156#M7420</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2019-05-07T04:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a FeatureLayer based on a FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605157#M7421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nicholas. I saw the example and I tried it, but I did not get the Property Layers, which contains a collection of FeatureLayers in it, which allow to do what I want to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But could you still explain why you can't create a FeatureLayer directly from a FeatureCollectionTable, but it's syntactically allowed by the API?&amp;nbsp;I find that very misleading.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 06:48:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605157#M7421</guid>
      <dc:creator>MaximilianGlas</dc:creator>
      <dc:date>2019-05-07T06:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a FeatureLayer based on a FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605158#M7422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wasn't involved in the design phase, but I suspect that this is down to&amp;nbsp;inheriting from FeatureTable (I'm not sure if the .NET API has OMDs so here's the one from the &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_table.html"&gt;iOS documentation&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="j-img-centered" height="233" src="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_table.png" style="color: #000000; display: block; margin-left: auto; margin-right: auto;" usemap="#AGSFeatureTable_map" width="822" /&gt;&lt;/P&gt;&lt;P&gt;I further suspect that to inherit&amp;nbsp;the properties of a FeatureTable without allowing the type model to accept it into the FeatureLayer constructor would involve some convoluted hierarchy and protocol designs&amp;nbsp;that might not even work well in&amp;nbsp;some SDKs. The solution&amp;nbsp;I can think of that would solve this through typing would really ugly up that diagram.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be fair, the error you get when you &lt;EM&gt;do&lt;/EM&gt; try isn't bad…&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;System.ArgumentException: 'Invalid argument: Cannot create a feature layer from a feature collection table. Add the feature collection table to a feature collection.'&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;…but I agree it could perhaps a little more usefully point you at the FeatureCollectionLayer as well&amp;nbsp;the FeatureCollection. I'll see if we can get that updated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2019 12:03:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-create-a-featurelayer-based-on-a/m-p/605158#M7422</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2019-05-07T12:03:27Z</dc:date>
    </item>
  </channel>
</rss>

