Hello all,
I’m wondering if there’s a way to style points based on metadata.
For example, I have a map that is plotting data points. The data has an associated “state” value for each point (at least in our data set). Is there a simple way to say, for example, if state is 1, the color is red. If state is 2, the color is blue and the symbol type is cross.
I can see doing this with multiple layers, and each state would have its own layer, but is it possible to do it all in one layer?
Thanks in advance,
Aaron
Frank4
June 25, 2020, 4:26pm
2
Thanks Aaron,
Yes. You could use ClassBreakStyle. You can find the sample in our how do I sample
I attached you the main file.
LoadClusterPointStyle.xaml (422 Bytes) LoadClusterPointStyle.xaml.cs (4.7 KB)
You can also use the ValueStyle
FourColorMap.xaml.cs (3.4 KB) FourColorMap.xaml (1.3 KB)
fourColorLayer = new InMemoryFeatureLayer();
ValueStyle valueStyle = new ValueStyle { ColumnName = “Color” };
valueStyle.ValueItems.Add(new ValueItem(“1”, AreaStyle.CreateSimpleAreaStyle(GeoColors.LightGreen)));
valueStyle.ValueItems.Add(new ValueItem(“2”, AreaStyle.CreateSimpleAreaStyle(GeoColors.LightSkyBlue)));
valueStyle.ValueItems.Add(new ValueItem(“3”, AreaStyle.CreateSimpleAreaStyle(GeoColors.Yellow)));
valueStyle.ValueItems.Add(new ValueItem(“4”, AreaStyle.CreateSimpleAreaStyle(GeoColors.LightPink)));
fourColorLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
fourColorLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layerOverlay.Layers.Add(fourColorLayer);
Thanks
Frank
Thanks Frank.
I had actually just been looking at the Four Color map example.
I’ll take a look at the LoadClusterPoint example as well.
Hey Frank,
using the ValueStyle, is it possible to specify more than one column name?
Frank4
June 25, 2020, 7:12pm
5
Thanks Aaron,
Yes. We do support that. You can take a look this one.
I wonder if it´s possible to use the valuestyle with different columns, I mean to use the field1 and field2 assigning a different style for that combination of values. You have some example?
Thanks in advance.
Thanks
Frank
Thanks Frank. I’ll take a look.