public void TestRealData() { var fdt = GetRealFeatureDataTable(); FillRealDataTable(fdt); var p = new SharpMap.Data.Providers.FeatureProvider(fdt); var m = new SharpMap.Map(new Size(640, 640)); m.Layers.Add(new TileLayer( new OsmTileSource(new OsmRequest(KnownTileServers.Mapnik) /*, new FileCache(@"d:\temp\OSM", "png")*/), "OSM")); var l = new HeatLayer(p, "Data", 0.001f); l.LayerName = "HEAT"; m.Layers.Add(l); #if DotSpatialProjections l.CoordinateTransformation = new DotSpatial.Projections.CoordinateTransformation { Source = ProjectionInfo.FromEpsgCode(4326), Target = ProjectionInfo.FromEpsgCode(3857) }; #else var ctfac = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(); l.CoordinateTransformation = ctfac.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator); #endif l.ZoomMin = 0;// 0.01 * m.GetExtents().Width; l.ZoomMax = /*0.9 * */m.GetExtents().Width; l.OpacityMax = 1; l.OpacityMin = 0.3f; m.ZoomToBox(l.Envelope); for (var i = 0; i < 5; i++) { using (var img = m.GetMap()) { img.Save("RealDataHeat" + i + ".png"); } m.Zoom /= 2; } m.ZoomToExtents(); using (var img = m.GetMap()) { img.Save("RealDataHeat.png"); } }
public void HeatLayerTest() { var m = new SharpMap.Map(new Size(640, 480)); var data = CreatingData.CreatePointFeatureDataTableFromArrays( CreatingData.GetRandomOrdinates(150, 5, 6), CreatingData.GetRandomOrdinates(150, 52, 53), null, CreatingData.GetRandomOrdinates(150, 0, 1)); var p = new SharpMap.Data.Providers.FeatureProvider(data); var l = new HeatLayer(p, "Data"); m.Layers.Add(l); m.ZoomToBox(new Envelope(5.4, 5.8, 52.4, 52.6)); //m.ZoomToExtents(); var img = m.GetMap(); img.Save("HeatMap.png", ImageFormat.Png); img.Dispose(); }