AnsweredAssumed Answered

FeatureCollectionTable Unique Value Renderer

Question asked by ag.timmons on Mar 21, 2019
Latest reply on May 14, 2019 by ag.timmons



In my mobile app, I am creating a new featureCollectionLayer by copying the selected features from a feature layer to a FeatureCollectionTable as follows-


 private async Task CreateNewFeatureCollection(FeatureQueryResult features, Renderer renderer)
            // Create the schema for the table

            var fields = features.First().FeatureTable.Fields;

            // Instantiate FeatureCollectionTables with schema and geometry type
            FeatureCollectionTable featureCollectionTable = new FeatureCollectionTable(fields, features.GeometryType, SpatialReferences.WebMercator);

            // Set rendering for each table
            featureCollectionTable.Renderer = renderer;

            foreach (Feature feature in features)
                Feature newFeature = featureCollectionTable.CreateFeature(feature.Attributes, feature.Geometry);
                await featureCollectionTable.AddFeatureAsync(newFeature);

            FeatureCollection featuresCollection = new FeatureCollection();

            // Create a FeatureCollectionLayer 
            FeatureCollectionLayer collectionLayer = new FeatureCollectionLayer(featuresCollection);

            // When the layer loads, zoom the map centered on the feature collection
            await collectionLayer.LoadAsync();

            // Add the layer to the Map's Operational Layers collection
            if(features.GeometryType == GeometryType.Point)
                if (Map.OperationalLayers.Count > 1)
                    Map.OperationalLayers.Insert(1, collectionLayer);


I use a unique value renderer for featureCollectionTable as follows-


     public Renderer GetTrailsQueryRenderer()

            UniqueValueRenderer renderer = new UniqueValueRenderer();


            SimpleLineSymbol hardLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.FromArgb(255, 51, 204), 2);
            SimpleLineSymbol softLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, System.Drawing.Color.FromArgb(255, 51, 204), 2);

            // Add values to the renderer: define the label, description, symbol, and attribute value for each
                new UniqueValue(" ", "Hard Surface", hardLineSymbol, "HardSurface"));
                new UniqueValue(" ", "Soft Surface", softLineSymbol, "SoftSurface"));

            // Set the default region fill symbol (transparent with no outline) for regions not explicitly defined in the renderer
            renderer.DefaultSymbol = hardLineSymbol;
            return renderer;


However the renderer doesn't work for unique values and only shows the hardLineSymbol because it has been set as the default symbol as well. I have checked the attributes of features and they look good its the renderer it seems that is not changing shapes for unique values.