private void BtnOSMWithNY_Click(object sender, RoutedEventArgs e) { var customTrans = new CustomMinimalTransformation(); customTrans.LoadSourceWKT("NYTOWNS_POLY.prj"); //this.xMapControl.RenderMode = Mapsui.UI.Wpf.RenderMode.Wpf; this.xMapControl.Map = new Mapsui.Map() { CRS = "EPSG:3857", Transformation = customTrans }; this.xMapControl.Map.Layers.Add(new TileLayer(KnownTileSources.Create(KnownTileSource.BingHybrid))); IProvider wShapeFile = new Mapsui.Desktop.Shapefile.ShapeFile("NYTOWNS_POLY.shp", true) { CRS = "EPSG:CUSTOM" }; var wLayerStyle = new Mapsui.Styles.VectorStyle(); wLayerStyle.Fill = new Mapsui.Styles.Brush { FillStyle = FillStyle.Solid, Color = Mapsui.Styles.Color.Gray }; wLayerStyle.Line = new Mapsui.Styles.Pen { Color = Mapsui.Styles.Color.Black, PenStyle = PenStyle.Solid }; wLayerStyle.Outline = new Mapsui.Styles.Pen { Color = Mapsui.Styles.Color.Black, PenStyle = PenStyle.Solid }; var wLayer = new Layer { Name = "NY Townships", DataSource = wShapeFile, Style = wLayerStyle, Enabled = true }; this.xMapControl.Map.Layers.Add(wLayer); this.xMapControl.Refresh(); }
private void BtnOSMWithUS_Click(object sender, RoutedEventArgs e) { var customTrans = new CustomMinimalTransformation(); customTrans.LoadSourceWKT(null); this.xMapControl.RenderMode = Mapsui.UI.Wpf.RenderMode.Wpf; this.xMapControl.Map = new Mapsui.Map() { CRS = "EPSG:3857", Transformation = customTrans }; this.xMapControl.Map.Layers.Add(new TileLayer(KnownTileSources.Create(KnownTileSource.OpenStreetMap))); IProvider wShapeFile = new Mapsui.Desktop.Shapefile.ShapeFile("lower48.shp", true) { CRS = "EPSG:4326" }; //IProvider wShapeFile = new Mapsui.Desktop.Shapefile.ShapeFile("lower48.shp", true); var wLayerStyle = new Mapsui.Styles.VectorStyle(); wLayerStyle.Fill = new Mapsui.Styles.Brush { FillStyle = FillStyle.Solid, Color = Mapsui.Styles.Color.Orange }; wLayerStyle.Line = new Mapsui.Styles.Pen { Color = Mapsui.Styles.Color.Black, PenStyle = PenStyle.Solid }; wLayerStyle.Outline = new Mapsui.Styles.Pen { Color = Mapsui.Styles.Color.Red, PenStyle = PenStyle.Solid }; var wLayer = new Layer { Name = "Lower 48 States", DataSource = wShapeFile, Style = wLayerStyle, Enabled = true }; this.xMapControl.Map.Layers.Add(wLayer); this.xMapControl.Refresh(); }