// // GET: /AddAClickEvent/ public ActionResult AddAClickEvent() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay("WorldMapKitOverlay"); map.CustomOverlays.Add(worldMapKitOverlay); InMemoryMarkerOverlay markerOverlay = new InMemoryMarkerOverlay("MarkerOverlay"); markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageWidth = 21; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageHeight = 25; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageOffsetX = -10.5f; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageOffsetY = -25f; markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; map.CustomOverlays.Add(markerOverlay); return(View(map)); }
// // GET: /LoadAHeatLayer/ public ActionResult LoadAHeatLayer() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-91.88, 43.17, -69.88, 29.86); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); //Shapefile Containing historical earthquake data ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(Server.MapPath("~/App_Data/quksigx020.shp")); featureSource.CustomColumnFetch += new EventHandler <CustomColumnFetchEventArgs>(featureSource_CustomColumnFetch); HeatLayer heatLayer = new HeatLayer(featureSource); heatLayer.HeatStyle = new HeatStyle(180, "EarthQuakeMagnitude", 0, 12); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(heatLayer); map.CustomOverlays.Add(staticOverlay); return(View(map)); }
public ActionResult PrintAMap() { Map map1 = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510); map1.CurrentExtent = new RectangleShape(-131.22, 55.05, -54.03, 16.91); map1.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map1.CustomOverlays.Add(worldMapKitOverlay); ShapeFileFeatureLayer usStatesLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/STATES.SHP")); usStatesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Transparent, GeoColor.FromArgb(255, 156, 155, 154), 1); usStatesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.StartCap = DrawingLineCap.Round; usStatesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(usStatesLayer); map1.CustomOverlays.Add(staticOverlay); return(View(map1)); }
// // GET: /ClickEventToHighlightOverlay/ public ActionResult ClickEventToHighlightOverlay() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-131.22, 55.05, -54.03, 16.91); map.MapUnit = GeographyUnit.DecimalDegree; map.MapTools.OverlaySwitcher.Enabled = true; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay("WorldMapKitOverlay"); map.CustomOverlays.Add(worldMapKitOverlay); Feature feature = new Feature(new RectangleShape(-110.22, 50, -80.03, 30)); map.HighlightOverlay.HighlightStyle = map.HighlightOverlay.Style; map.HighlightOverlay.Features.Add("feature", feature); map.Popups.Add(new CloudPopup("Popup") { AutoSize = true }); return(View(map)); }
public ActionResult DrawUsingZedGraphStyle(Map map, GeoCollection <object> args) { if (null == map) { map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510); map.CurrentExtent = new RectangleShape(-123.41875, 41.96396484375, -107.158984375, 30.36240234375); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); //Create our Zedgraph Sytle and wire up the event. ZedGraphStyle zedGraphStyle = new ZedGraphStyle(); zedGraphStyle.ZedGraphDrawing += new EventHandler <ZedGraphDrawingEventArgs>(zedGraphStyle_ZedGraphDrawing); zedGraphStyle.RequiredColumnNames.Add("WHITE"); zedGraphStyle.RequiredColumnNames.Add("ASIAN"); zedGraphStyle.RequiredColumnNames.Add("AREANAME"); ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cities_a.shp")); citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(zedGraphStyle); citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(WorldStreetsTextStyles.GeneralPurpose("AREANAME", 8)); citiesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("Cities", citiesLayer); staticOverlay.IsBaseOverlay = false; map.CustomOverlays.Add(staticOverlay); currentMap = map; } return(View(map)); }
// // GET: /LoadAMapFromStreams/ public ActionResult LoadAMapFromStreams() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer("cntry02.shp"); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ((ShapeFileFeatureSource)worldLayer.FeatureSource).StreamLoading += new EventHandler <StreamLoadingEventArgs>(LoadAMapFromStreams_StreamLoading); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(worldLayer); map.CustomOverlays.Add(staticOverlay); return(View(map)); }
// // GET: /UsingCustomData/ public ActionResult UsingCustomData() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Test", "Arial", 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Red, 0, -12); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.FeatureSource.CustomColumnFetch += new EventHandler <CustomColumnFetchEventArgs>(FeatureSource_CustomColumnFetch); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.RequiredColumnNames.Add("Test"); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(worldLayer); map.CustomOverlays.Add(staticOverlay); return(View(map)); }
// // GET: /FindWorldCoordinatesWhereClicked/ public ActionResult FindWorldCoordinatesWhereClicked() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-131.22, 55.05, -54.03, 16.91); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitWmsWebOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitWmsWebOverlay); return(View(map)); }
// // GET: /FindTheFeatureTheUserClicked/ public ActionResult FindFeatureClicked() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay("WorldMapKitOverlay"); map.CustomOverlays.Add(worldMapKitOverlay); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(ControllerContext.HttpContext.Server.MapPath("~/App_Data/Countries02.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay("WorldStaticOverlay"); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add("WorldLayer", worldLayer); InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 60, 180, 60), GeoColor.GeographicColors.DeepOcean); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay dynamicOverlay = new LayerOverlay("HightLightDynamicOverlay"); dynamicOverlay.Layers.Add("HighLightLayer", highlightLayer); dynamicOverlay.IsBaseOverlay = false; map.CustomOverlays.Add(staticOverlay); map.CustomOverlays.Add(dynamicOverlay); map.Popups.Add(new CloudPopup("information") { AutoSize = true, IsVisible = false }); return(View(map)); }
// // GET: /GetAllFeatures/ public ActionResult GetAllFeatures() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4")); map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay("StaticOverlay"); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(worldLayer); map.CustomOverlays.Add(staticOverlay); ViewData["map"] = map; DataTable dataTable = BindAllFeaturesToGridView(worldLayer); Collection <Country> countries = new Collection <Country>(); foreach (DataRow row in dataTable.Rows) { Country country = new Country(); country.CountryId = row["CountryId"].ToString(); country.CountryName = row["CountryName"].ToString(); country.Currency = row["Currency"].ToString(); countries.Add(country); } return(View(countries)); }
// // GET: /FindFeaturesWithinDistance/ public ActionResult FindFeaturesWithinDistance() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4")); map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay("StaticOverlay"); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add("WorldLayer", worldLayer); map.CustomOverlays.Add(staticOverlay); InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateCompoundPointStyle(PointSymbolType.Square, GeoColor.StandardColors.White, GeoColor.StandardColors.Black, 1F, 8F, PointSymbolType.Square, GeoColor.StandardColors.Navy, GeoColor.StandardColors.Transparent, 0F, 4F); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(150, 154, 205, 50)); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay dynamicOverlay = new LayerOverlay("DynamicOverlay"); dynamicOverlay.IsBaseOverlay = false; dynamicOverlay.TileType = TileType.SingleTile; dynamicOverlay.Layers.Add("HighlightLayer", highlightLayer); map.CustomOverlays.Add(dynamicOverlay); return(View(map)); }
// // GET: /GetDistanceBetweenTwoPoints/ public ActionResult GetDistanceBetweenTwoPoints() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-131.22, 55.05, -54.03, 16.91); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitWmsWebOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitWmsWebOverlay); InMemoryFeatureLayer pointShapeLayer = new InMemoryFeatureLayer(); pointShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.StandardColors.Red, 8); pointShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; InMemoryFeatureLayer lineShapeLayer = new InMemoryFeatureLayer(); lineShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColor.StandardColors.Red, 3)); lineShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay dynamicOverlay = new LayerOverlay("DynamicOverlay"); dynamicOverlay.IsBaseOverlay = false; dynamicOverlay.TileType = TileType.SingleTile; dynamicOverlay.Layers.Add("pointShapeLayer", pointShapeLayer); dynamicOverlay.Layers.Add("lineShapeLayer", lineShapeLayer); map.CustomOverlays.Add(dynamicOverlay); map.Popups.Add(new CloudPopup("information") { AutoSize = true, IsVisible = false }); return(View(map)); }
private void AddBaseMapLayers() { WorldMapKitWmsWebOverlay worldMapKitWmsRoadOverlay = new WorldMapKitWmsWebOverlay("World Map Kit Road"); worldMapKitWmsRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator; worldMapKitWmsRoadOverlay.MapType = WorldMapKitMapType.Road; Map1.CustomOverlays.Add(worldMapKitWmsRoadOverlay); WorldMapKitWmsWebOverlay worldMapKitWmsAerialOverlay = new WorldMapKitWmsWebOverlay("World Map Kit Aerial"); worldMapKitWmsAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator; worldMapKitWmsAerialOverlay.MapType = WorldMapKitMapType.Aerial; Map1.CustomOverlays.Add(worldMapKitWmsAerialOverlay); WorldMapKitWmsWebOverlay worldMapKitWmsAerialWithLabelsOverlay = new WorldMapKitWmsWebOverlay("World Map Kit Aerial With Lables"); worldMapKitWmsAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator; worldMapKitWmsAerialWithLabelsOverlay.MapType = WorldMapKitMapType.AerialWithLabels; Map1.CustomOverlays.Add(worldMapKitWmsAerialWithLabelsOverlay); OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay("Open Street Map"); Map1.CustomOverlays.Add(openStreetMapOverlay); }