<?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: Converting a Feature Into a Layer in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/converting-a-feature-into-a-layer/m-p/708782#M18956</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One possible solution is to use the CreateSelectionLayer method with IFeatureLayerDefinition interface. First, construct a temporalLayer using the first function; then construct a query Filter for each feature in the loop; and call the second function to create one individual layer per feature. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
public ITemporalLayer CreateTemporalLayer(IFeatureClass featureClass, string layerName, string trackIdField, string timeField)
{
 ITemporalLayer temporalLayer = new TemporalFeatureLayerClass();
 IFeatureLayer featureLayer = (IFeatureLayer)temporalLayer;
 featureLayer.FeatureClass = featureClass;
 featureLayer.Name = layerName;
 ITemporalRenderer temporalRenderer = (ITemporalRenderer)temporalLayer.Renderer;
 temporalRenderer.TemporalObjectColumnName = trackIdField;
 temporalRenderer.TemporalFieldName = timeField;
 temporalRenderer.ShowObservationLegendGroup = true;
 temporalRenderer.ShowTimeLegendGroup = true;
 temporalRenderer.Renderer = (IFeatureRenderer)temporalRenderer;
 return temporalLayer;
}

private ITemporalLayer CreateLayerSubset(IQueryFilter queryFilter, ITemporalLayer temporalLayer)
{
 IFeatureSelection featureSelection = (IFeatureSelection)temporalLayer;
 featureSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
 if(featureSelection.SelectionSet.Count == 0)
&amp;nbsp; throw new NoDataException();
 IFeatureLayerDefinition featureLayerDefinition = (IFeatureLayerDefinition)temporalLayer;
 ITemporalLayer queryResult = (ITemporalLayer)featureLayerDefinition.CreateSelectionLayer(temporalLayer.Name, true, null, null);
 return queryResult;
}&amp;nbsp; 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:46:22 GMT</pubDate>
    <dc:creator>FengZhang2</dc:creator>
    <dc:date>2021-12-12T05:46:22Z</dc:date>
    <item>
      <title>Converting a Feature Into a Layer</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/converting-a-feature-into-a-layer/m-p/708781#M18955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I am looping through a series of features using a featurecursor, how can I create a temporary layer of each feature? I'm planning on using the resulting layer as input to a geoprocessing tool (clip).&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim pFCursor as IFeatureCursor
Dim pFeature as IFeature = pFCursor.NextFeature
Do Until pFeature is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp; Need to create ILayer object from pFeature here
&amp;nbsp;&amp;nbsp;&amp;nbsp; pFeature = pFCursor.NextFeature
Loop&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/converting-a-feature-into-a-layer/m-p/708781#M18955</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2021-12-12T16:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a Feature Into a Layer</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/converting-a-feature-into-a-layer/m-p/708782#M18956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One possible solution is to use the CreateSelectionLayer method with IFeatureLayerDefinition interface. First, construct a temporalLayer using the first function; then construct a query Filter for each feature in the loop; and call the second function to create one individual layer per feature. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
public ITemporalLayer CreateTemporalLayer(IFeatureClass featureClass, string layerName, string trackIdField, string timeField)
{
 ITemporalLayer temporalLayer = new TemporalFeatureLayerClass();
 IFeatureLayer featureLayer = (IFeatureLayer)temporalLayer;
 featureLayer.FeatureClass = featureClass;
 featureLayer.Name = layerName;
 ITemporalRenderer temporalRenderer = (ITemporalRenderer)temporalLayer.Renderer;
 temporalRenderer.TemporalObjectColumnName = trackIdField;
 temporalRenderer.TemporalFieldName = timeField;
 temporalRenderer.ShowObservationLegendGroup = true;
 temporalRenderer.ShowTimeLegendGroup = true;
 temporalRenderer.Renderer = (IFeatureRenderer)temporalRenderer;
 return temporalLayer;
}

private ITemporalLayer CreateLayerSubset(IQueryFilter queryFilter, ITemporalLayer temporalLayer)
{
 IFeatureSelection featureSelection = (IFeatureSelection)temporalLayer;
 featureSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
 if(featureSelection.SelectionSet.Count == 0)
&amp;nbsp; throw new NoDataException();
 IFeatureLayerDefinition featureLayerDefinition = (IFeatureLayerDefinition)temporalLayer;
 ITemporalLayer queryResult = (ITemporalLayer)featureLayerDefinition.CreateSelectionLayer(temporalLayer.Name, true, null, null);
 return queryResult;
}&amp;nbsp; 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:46:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/converting-a-feature-into-a-layer/m-p/708782#M18956</guid>
      <dc:creator>FengZhang2</dc:creator>
      <dc:date>2021-12-12T05:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a Feature Into a Layer</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/converting-a-feature-into-a-layer/m-p/708783#M18957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What about setting the definition query of the initial layer using the feature???s&amp;nbsp; ID and feeding that layer into the clip tool?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 18:51:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/converting-a-feature-into-a-layer/m-p/708783#M18957</guid>
      <dc:creator>JohnNelson3</dc:creator>
      <dc:date>2012-06-21T18:51:12Z</dc:date>
    </item>
  </channel>
</rss>

