MsSql2008FeatureLayer msLayer = ((LayerOverlay)Map1.CustomOverlays[“Province”]).Layers[0] as MsSql2008FeatureLayer;
msLayer.CommandTimeout = 1200;
msLayer.Open();
Collection<Feature> collectFeature = msLayer.QueryTools.GetAllFeatures(new string[] { “PROV_NAME” });
msLayer.Close();
LayerOverlay lyOverlay = (LayerOverlay)Map1.CustomOverlays[“ThematicLayer”];
InMemoryFeatureLayer imf = lyOverlay.Layers[0] as InMemoryFeatureLayer;
imf.InternalFeatures.Clear();
foreach (DataRow dr in dt.Rows)
{
foreach (Feature ft in collectFeature)
{
//3.match id
if (ft.ColumnValues[“Prov_Name”].ToString() == dr[“PROV_NAME”].ToString())
{
//4.add value to feature
ft.ColumnValues.Add(“thematic”, dr[“AffectAreaByPer”].ToString());
//5.add to thematic
imf.InternalFeatures.Add(ft);
break;
}
}
}
ClassBreakStyle cbs = new ClassBreakStyle(“thematic”);
cbs.BreakValueInclusion = BreakValueInclusion.IncludeValue;
cbs.ClassBreaks.Add(new ClassBreak(double.MinValue, AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent)));
cbs.ClassBreaks.Add(new ClassBreak(40, AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#c0c0c0"), GeoColor.StandardColors.Black)));
cbs.ClassBreaks.Add(new ClassBreak(60, AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#ffff99"), GeoColor.StandardColors.Black)));
cbs.ClassBreaks.Add(new ClassBreak(80, AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#fcd5b4"), GeoColor.StandardColors.Black)));
cbs.ClassBreaks.Add(new ClassBreak(double.MaxValue, AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml("#ff0000"), GeoColor.StandardColors.Black)));
imf.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(cbs);
imf.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
lyOverlay.Redraw();
//ScriptManager.RegisterClientScriptBlock(UpdatePanel1, Page.GetType(), “RefreshThematic”, “javascript:Map1.GetMapParser().map.getLayer(‘ThematicLayer’).redraw(true);”, true);
ScriptManager.RegisterClientScriptBlock(UpdatePanel1, Page.GetType(), “RefreshThematic”, “javascript:RefreshProvinceThematic();”, true);
above code is about create thematic map.
Work flow :
1. select choice from drop down list
2. click for make thematic
3. query report from DB and add to DataTable (My value is average of area.it’s double type)
4. foreach to add interested column to Layer
5. add it to inmemoryfeature
6. add range style with class brake style.
7. refresh map with javascript.
end
the code isn’ not bug but it not show style.
I think it has problem about column value.it’s string type.
I think it (column value) can’t use in class break style.because data type added to Feature is string.
My thematic map need to use ClassBreakStyle for make thematic by range value.
How do I? This solution is important for me.
another question.
at comment 4 : I have question.
Can Feature.ColumnValues not add datat type int ?
I think it should support another data type to add.
If you misundertand please tell me
thanks so much