I took the version 9 example of having a shape file overlayed on a google map and coverted it to use MapSuite v10. In addition , I would like to project google maps to the shapefile’s projection. When I run this code however I get a undecipherable error message.
Here is the code that I used and modified from the example
//We need to set the map unit to meter because we are using Google Map Spherical Mercator projection.
winformsMap1.MapUnit = GeographyUnit.Meter;
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));
//Sets Google Map as the background map.
GoogleMapsOverlay googleMapsOverlay = new GoogleMapsOverlay();
winformsMap1.Overlays.Add(googleMapsOverlay);
// setup proj for google
Proj4Projection calproj4 = new Proj4Projection();
string projName = @"..\..\Data\CA_Boundary_WGS84_UTM11N.prj";
string prjFileText = System.IO.File.ReadAllText(projName);
calproj4.InternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(); //Geodetic projection (Longitude/Latitude).
calproj4.ExternalProjectionParametersString = Proj4Projection.ConvertPrjToProj4(prjFileText);
googleMapsOverlay.ProjectionFromSphericalMercator = calproj4;
ShapeFileFeatureLayer calShapeLayer = new ShapeFileFeatureLayer(@"..\..\Data\CA_Boundary_WGS84_UTM11N.shp");
calShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.StandardColors.Red, GeoColor.StandardColors.Black, 9);
calShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateMaskTextStyle("NAME", new GeoFont("Arial", 10, DrawingFontStyles.Bold),
new GeoSolidBrush(GeoColor.StandardColors.Black), new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.LightGoldenrodYellow)), 13, 0);
calShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
calShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
//Sets the projection to the shapefile layer.
//calShapeLayer.FeatureSource.Projection = proj4;
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("California", calShapeLayer);
winformsMap1.Overlays.Add(staticOverlay);
//Sets the extent of the map as the bounding box of the shapefile layer as projected (Google Map Spherical Mercator).
calShapeLayer.Open();
winformsMap1.CurrentExtent = calShapeLayer.GetBoundingBox();
calShapeLayer.Close();
winformsMap1.Refresh();
Error I get is
{“The type initializer for ‘fSQ=.8EU=’ threw an exception.”}