protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); Map1.CurrentExtent = new RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962); Map1.MapUnit = GeographyUnit.Meter; Map1.CustomOverlays.Add(new GoogleOverlay("BackgroundOverlay")); } } protected void btnThinkGeo_Click(object sender, EventArgs e) { if (Map1.CustomOverlays.Contains("BackgroundOverlay")) { Map1.CustomOverlays.Remove("BackgroundOverlay"); } BingMapsOverlay bingMapsOverlay = new BingMapsOverlay("BackgroundOverlay"); bingMapsOverlay.MapType = BingMapsStyle.Road; Map1.CustomOverlays.Add(bingMapsOverlay); } protected void btnGoogle_Click(object sender, EventArgs e) { if (Map1.CustomOverlays.Contains("BackgroundOverlay")){ Map1.CustomOverlays.Remove("BackgroundOverlay"); } GoogleOverlay google = new GoogleOverlay ("BackgroundOverlay"); google.GoogleMapType = GoogleMapType.Normal; Map1.CustomOverlays.Insert(0, google ); } protected void btnAddShape_Click(object sender, EventArgs e) { if (Map1.CustomOverlays.Contains("staticOverlay")) { Map1.CustomOverlays.Remove("staticOverlay"); } ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(MapPath("~/SampleData/world/cntry02.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Red)); // convert the projection from EPSG 4326 to 900913(google) Proj4Projection pro4 = new Proj4Projection(); pro4.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString(); pro4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(); pro4.Open(); worldLayer.FeatureSource.Projection = pro4; LayerOverlay staticOverlay = new LayerOverlay("staticOverlay"); // make sure 'IsBaseOverlay' is false. staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(worldLayer); Map1.CustomOverlays.Add(staticOverlay); }