This project is read-only.

Odd Behavior with ClassificationType.Quantities & IntervalMethod.EqualInterval

Mar 3, 2012 at 10:28 AM

I am experiencing odd map rendering when I try to use ClassificationType.Quantities in a PolygonScheme.  Using the code below, I add a field to a layer.dataset.datatable and then using data from another datatable and a common field  to index on and add the data.  Then based on whether the new field is a string field or a numeric field I set up a uniquevalues oir quantities scheme.  The uniquevalues scheme works great, but the quantities scheme renders the map eratically.  If the map is zoomed out, only one polygon is rendered, all the rest are missing, if the map is zoomed in, then all the polygons render.  If the map is zoomed out (one polygon showing) and you pan the map around, spractically other polygons will suddenly render on the map as you pan around.

Any Help would be greatly appreciated.

           DataColumn DC = MapDataTable.Columns[Fieldname];

            MapPolygonLayer MyLayer = (MapPolygonLayer) ProviderMap.Layers[0];
            DataTable LayerDT = MyLayer.DataSet.DataTable;
            DataColumn AddColumn = new DataColumn(DC.ColumnName, DC.DataType);
            LayerDT.Columns.Add(AddColumn);

            foreach (DataRow DR in LayerDT.Rows)
            {
                string pfcode = DR["Provider"].ToString().Trim(); 
                // Get the Provider Field code for this SHape File Record
                // find this code in Scenario DataTable
                foreach (DataRow ScnDR in MapDataTable.Rows)
                {
                    string Scnpfcode = ScnDR["PRVDCODE"].ToString().Trim();
                    if (pfcode == Scnpfcode)
                    {
                        DR[Fieldname] = ScnDR[Fieldname].ToString();
                        break;
                    }
                }
            }

            if (DC.DataType == System.Type.GetType("System.String"))
            {
                PolygonScheme FldScheme = new PolygonScheme();
                FldScheme.EditorSettings.ClassificationType = ClassificationType.UniqueValues;
                ////Set the UniqueValue field name
                FldScheme.EditorSettings.FieldName = Fieldname;
                // Create Catagories based on data
                FldScheme.CreateCategories(MapDataTable);
                MyLayer.Symbology = FldScheme;
            }
            else
            {
                PolygonScheme FldScheme = new PolygonScheme();
                FldScheme.EditorSettings.ClassificationType = ClassificationType.Quantities;
                FldScheme.EditorSettings.IntervalMethod = IntervalMethod.EqualInterval;
                FldScheme.EditorSettings.NumBreaks = 8;
                FldScheme.EditorSettings.FieldName = Fieldname;
                FldScheme.AppearsInLegend = true;
                FldScheme.CreateCategories(MapDataTable);
                MyLayer.Symbology = FldScheme;
            }
 

                        



 



Mar 3, 2012 at 11:01 AM

OK, I found the cause of the problem, which makes me think this is a bug unless there is a setting somehwhere I have missed.  The datatable, for both string columns and numeric columns has null column values (ie missing).  When the scheme is a numeric using quantities, the map does not render polygons with a missing value, when a substantial portion of a polygon with a missing value is in the map window, then map renders all polygons erradically, actually does not render all but one (perhaps all until it encounters a missing value).   If I replace the missing values with zeros, the map renders just fine.   I even tried adding a catagory for null values, and that made no difference.

This is not true for string fields.  The map renders find even though some rows/columns have missing values.