/// <summary> /// Create a heat style that bases the color intensity on the proximity of surrounding points /// </summary> private void AddHeatStyle(ShapeFileFeatureLayer layer) { // Create the heat style var heatStyle = new HeatStyle(20, 1, DistanceUnit.Kilometer); // Add the point style to the collection of custom styles for ZoomLevel 1. layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(heatStyle); // Apply the styles for ZoomLevel 1 down to ZoomLevel 20. This effectively applies the point style on every zoom level on the map. layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; }
private void Refresh() { ShapefileLayer pointLayer = Map1.FindLayer <ShapefileLayer>("cities-900913"); if (pointLayer == null) { return; } HeatStyle heatStyle = (HeatStyle)pointLayer.Styles[0]; heatStyle.Radius = (2 - HeatPointSizeComboBox.SelectedIndex) * 30 + 20; heatStyle.ColorPaletteType = colorPaletteType; Map1.Refresh(RefreshType.Redraw); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; Map1.UseOpenStreetMapAsBaseMap(); ShapefileLayer pointLayer = new ShapefileLayer("SampleData/cities-900913.shp"); HeatStyle heatStyle = new HeatStyle(); heatStyle.DataColumn = columnName; heatStyle.MaxIntensity = 37.7; heatStyle.MinIntensity = 30; heatStyle.Alpha = 150; heatStyle.Radius = (2 - HeatPointSizeComboBox.SelectedIndex) * 30 + 20; heatStyle.ColorPaletteType = colorPaletteType; pointLayer.Styles.Add(heatStyle); Map1.AddStaticLayers("PointOverlay", pointLayer); Map1.ZoomTo(pointLayer.GetBound()); }
private void TestForm_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-125, 47, -67, 25); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); //Displays the World Map Kit as a background. WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay(); winformsMap1.Overlays.Add(worldMapKitDesktopOverlay); //Point based ShapeFileFeatureSource on earth quakes used for the HeatOverlay. ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(@"..\..\Data\quksigx020.shp"); //Creates the HeatOverlay with the point based ShapeFileFeatureSource for earthquakes. HeatLayer heatLayer = new HeatLayer(featureSource); //Creates the HeatStyle to set the properties determining the display of the heat map with earth quake data. //Notice that each point is treated with an intensity depending on the value of the column "other_magn1". //So, in addition to the density of points location, the value for each point is also going to be counted into account //for the coloring of the map. HeatStyle heatStyle = new HeatStyle(); heatStyle.IntensityColumnName = "other_mag1"; heatStyle.IntensityRangeStart = 0; heatStyle.IntensityRangeEnd = 12; //Sets the size of each point 100 kilometers of diameter. heatStyle.Alpha = 180; heatStyle.PointRadius = 60; heatStyle.PointRadiusUnit = DistanceUnit.Kilometer; heatLayer.HeatStyle = heatStyle; LayerOverlay heatMapOverlay = new LayerOverlay(); heatMapOverlay.Layers.Add(heatLayer); winformsMap1.Overlays.Add("HeatOverlay", heatMapOverlay); winformsMap1.Refresh(); }