AnsweredAssumed Answered

GenerateRendererTask with Dynamic Workspace

Question asked by ccposton on Feb 11, 2013
Latest reply on Feb 12, 2013 by ccposton
Is it possible to use the GenerateRendererTask to generate a ClassBreaksRenderer for a dynamic FeatureLayer? I posted my current code below. I get an exception when executing the renderer task ("Invalid or missing input parameters."). My featureLayer.Url is http://<my-mapservice-url>/dynamicLayer.

I found this similar post under the Flex forums: http://forums.arcgis.com/threads/69563-Dynamic-workspace-and-generate-renderer

The solution there specifically says that I must set the Source property of the GenerateRendererTask. There is no Source property in the WPF api.


GenerateRendererTask generateRendererTask = new GenerateRendererTask(featureLayer.Url);     GenerateRendererParameters generateRendererParameters = new GenerateRendererParameters();      ClassBreaksDefinition classification = new ClassBreaksDefinition();     classification.BreakCount = 10;     classification.ClassificationField = "prop_id";     classification.ClassificationMethod = ClassificationMethod.NaturalBreaks;      ColorRamp colorRamp = new ColorRamp();     colorRamp.Algorithm = Algorithm.LabLChAlgorithm;     colorRamp.From = Colors.Yellow;     colorRamp.To = Colors.Red;      List<ColorRamp> colorRamps = new List<ColorRamp>();     colorRamps.Add(colorRamp);      classification.ColorRamps = new ObservableCollection<ColorRamp>(colorRamps);      generateRendererParameters.ClassificationDefinition = classification;      GenerateRendererResult generateRendererResult = generateRendererTask.Execute(generateRendererParameters);     featureLayer.Renderer = generateRendererResult.Renderer as ClassBreaksRenderer;

Outcomes