Ok, sample code below, it won't compile but should give you some idea what is going on:
If I set columnName to a column that has string values and modify the values in ValueItems to match those values, the map will show features. If I set columnName to a column is of number type, and modify the ValueItems to numbers to match the values in the shape file, nothing is shown on the map. The data is in a .dbf file which is located in the same folder shape file located.
Thanks
private void InitializeMap()
{
CurrentMap.MapUnit = GeographyUnit.Meter;
CurrentMap.MapTools.MouseCoordinate.Enabled = true;
CurrentMap.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.DeepOcean);
CurrentMap.CustomOverlays.Add(GetShapeOverlay());
SetMapFullExtent();
}
private LayerOverlay GetShapeOverlay()
{
ShapeFileFeatureLayer ShapeLayer = GetCrashLocationShapeLayer();
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = Config.Current.InternalProjectionParametersString;
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
ShapeLayer.FeatureSource.Projection = proj4;
LayerOverlay shapeOverlay = new LayerOverlay(ShapeFileLayerOverlayName, false, TileType.SingleTile);
shapeOverlay.Layers.Add(ShapeLayer);
shapeOverlay.TransitionEffect = TransitionEffect.None;
return shapeOverlay;
}
private ShapeFileFeatureLayer GetCrashLocationShapeLayer()
{
string columnName = "NumberOfLa";
ShapeFileFeatureLayer shapeLayer = new ShapeFileFeatureLayer(MapPath(Config.Current.CrashLocationShapeFile));
MapHelper.BuildIndexFile(shapeLayer, MapPath(Config.Current.CrashLocationShapeFile));
shapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(GetValueStyle(columnName));
shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
shapeLayer.DrawingQuality = DrawingQuality.Default;
shapeLayer.DrawingMarginPercentage = 50;
return shapeLayer;
}
private ValueStyle GetValueStyle(string column)
{
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = column;
valueStyle.ValueItems.Add(new ValueItem("0", PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.LightYellow, 12, GeoColor.StandardColors.Black)));
valueStyle.ValueItems.Add(new ValueItem("1", PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.Yellow, 12, GeoColor.StandardColors.Black)));
valueStyle.ValueItems.Add(new ValueItem("2", PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.Orange, 12, GeoColor.StandardColors.Black)));
valueStyle.ValueItems.Add(new ValueItem("3", PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.OrangeRed, 12, GeoColor.StandardColors.Black)));
valueStyle.ValueItems.Add(new ValueItem("4", PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.Red, 12, GeoColor.StandardColors.Black)));
valueStyle.ValueItems.Add(new ValueItem("5", PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.Blue, 12, GeoColor.StandardColors.Black)));
valueStyle.ValueItems.Add(new ValueItem("6", PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.Purple, 12, GeoColor.StandardColors.Black)));
return valueStyle;
}