Good day, I’m new in using MVC and can not figure out what’s wrong with my code? Please tell what’s wrong with my code below and also experiencing error with JScript and using v7.0 of Mapsuite: Thanks!
Microsoft JScript runtime error: Unable to get value of the property ‘toUpperCase’: object is null or undefined
Code:
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@“C:\MVC\KSA.shp”);
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
worldLayer.Open();
RectangleShape rect = worldLayer.GetBoundingBox();
worldLayer.Close();
// Create a legend item for the title.
LegendItem title = new LegendItem();
title.TextStyle = new TextStyle(“Map Legend”, new GeoFont(“Arial”, 10, DrawingFontStyles.Bold), new GeoSolidBrush
GeoColor.SimpleColors.Black));
// Create a legend item for the borders. This example uses a modified LineStyle.
LegendItem legendItem1 = new LegendItem();
LineStyle stateBorderStyle = new LineStyle();
stateBorderStyle.OuterPen.DashStyle = LineDashStyle.Dash;
stateBorderStyle.OuterPen.Width = 2;
stateBorderStyle.OuterPen.Color = GeoColor.FromArgb(255, 156, 155, 154);
legendItem1.ImageStyle = stateBorderStyle;
legendItem1.TextStyle = new TextStyle(“Borders”, new GeoFont(“Arial”, 8), new GeoSolidBrush(GeoColor.SimpleColors.Black));
LegendItem legendItem2 = new LegendItem();
legendItem2.ImageStyle =AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 167, 204, 149));
legendItem2.TextStyle = new TextStyle(“Desserts”, new GeoFont(“Arial”, 8), new GeoSolidBrush(GeoColor.SimpleColors.Brown));
// Create A legend item for the airports. This example uses a .png file.
LegendItem legendItem3 = new LegendItem();
legendItem3.ImageStyle = new PointStyle(new GeoImage(@"…\Resources\airport_small_size3.png"));
legendItem3.TextStyle = new TextStyle(“Airports”, new GeoFont(“Arial”, 8), new GeoSolidBrush(GeoColor.SimpleColors.Black));
// Create the LegendAdornmentLayer and add the LegendItems.
LegendAdornmentLayer legendLayer = new LegendAdornmentLayer();
legendLayer.BackgroundMask = AreaStyles.CreateLinearGradientStyle(new GeoColor(255, 255, 255, 255), new GeoColor(255, 230, 230, 230), 90, GeoColor.SimpleColors.Black);
legendLayer.LegendItems.Add(legendItem1);
legendLayer.LegendItems.Add(legendItem2);
legendLayer.LegendItems.Add(legendItem3);
legendLayer.Height = 125;
legendLayer.Title = title;
legendLayer.Location = AdornmentLocation.LowerLeft;
AdornmentOverlay adornmentOverlay = new AdornmentOverlay(“MapL”);
adornmentOverlay.Layers.Add(“LengendLayer”, legendLayer);
Html.ThinkGeo().Map(“Map1”, new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510)
.MapUnit(GeographyUnit.DecimalDegree)
.MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))))
.CustomOverlays(overlays =>
{
ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(@“C:\MVC\all_poi.shp”);
citiesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Character;
citiesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.CharacterFont = new GeoFont(“Riyadh Xplorer”, 18);
citiesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.CharacterIndex = 49;
citiesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.CharacterSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Red); citiesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = new GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Black), 1);
citiesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
citiesLayer.DrawingMarginPercentage = 100;
overlays.LayerOverlay().Layer(worldLayer).IsBaseOverlay(false);
overlays.LayerOverlay(“StaticOverlay”).IsBaseOverlay(false).Layer(“CitiesLayer”, citiesLayer);
overlays.AdormentOverlay(“MapL”).Layer(“LengendLayer”, legendLayer);
})
{
})
.Render();
}