private void btnActivate_Click(object sender, EventArgs e) { // It is important to set the map unit first to either feet, meters or decimal degrees. mapView.MapUnit = GeographyUnit.Meter; // Set the map zoom level set to the bing map zoom level set so all the zoom levels line up. mapView.ZoomLevelSet = new BingMapsZoomLevelSet(256); // Create the layer overlay with some additional settings and add to the map. LayerOverlay layerOverlay = new LayerOverlay() { TileHeight = 256, TileWidth = 256 }; layerOverlay.TileSizeMode = TileSizeMode.Small; layerOverlay.MaxExtent = MaxExtents.BingMaps; mapView.Overlays.Add("Bing Map", layerOverlay); // Create the bing map layer and add it to the map. BingMapsLayer bingMapsLayer = new BingMapsLayer(txtApplicationID.Text, BingMapsMapType.Road, "C:\\temp"); layerOverlay.Layers.Add(bingMapsLayer); // Set the current extent to the whole world. mapView.CurrentExtent = new RectangleShape(-10000000, 10000000, 10000000, -10000000); // Refresh the map. mapView.Refresh(); }
private void MapTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { BingMapsLayer bingMapsLayer = Map1.FindLayer <BingMapsLayer>("Bing Maps"); if (bingMapsLayer != null) { bingMapsLayer.MapsType = (BingMapsType)MapTypeComboBox.SelectedItem; Map1.Refresh(RefreshType.Redraw); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); var bingMapLayer = new BingMapsLayer ("ENTER_YOUR_API_KEY",BingMapsLayer.MapStyle.Aerial); var map = FindViewById<MapView> (Resource.Id.mapView); map.AddLayer (bingMapLayer); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var bingMapLayer = new BingMapsLayer("ENTER_YOUR_API_KEY", BingMapsLayer.MapStyle.Aerial); var map = FindViewById <MapView> (Resource.Id.mapView); map.AddLayer(bingMapLayer); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; BingMapsLayer bingMapsLayer = new BingMapsLayer(BingMapsType.Road, "AhDBjJalvtRXvYe6BsKuj2DwHT9Atlkas7HNVU7rDvoUvIu0_L_GVtSc8y9gNP61"); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(bingMapsLayer); Map1.Overlays.Add(layerOverlay); // We can also use the code below to add a google maps to our map. // Map1.UseBingMapsAsBaseMap(BingMapsType.Road, "Your BingMaps Key"); Map1.ZoomToFullBound(); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; BingMapsLayer bingMapsLayer = new BingMapsLayer(BingMapsType.Road, "AswP3q2unPpwB7h5xK-DbPvN_2ZbjQqGeQ18dp3HfSn3IKon4dLM3-IDX3jswTMd"); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(bingMapsLayer); Map1.Overlays.Add(layerOverlay); // We can also use the code below to add a google maps to our map. // Map1.UseBingMapsAsBaseMap(BingMapsType.Road, "Your BingMaps Key"); Map1.ZoomToFullBound(); }
private void WpfMap_Loaded(object sender, RoutedEventArgs e) { // Please set your own information about those parameters below. string applicationID = "Your ApplicationID"; string cacheDirectory = @"c:\temp\"; BingMapsLayer worldLayer = new BingMapsLayer(applicationID, BingMapsMapType.Road, cacheDirectory); wpfMap1.MapUnit = GeographyUnit.Meter; wpfMap1.CurrentExtent = new RectangleShape(-10000000, 10000000, 10000000, -10000000); LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("WorldLayer", worldLayer); wpfMap1.Overlays.Add("WorldOverlay", worldOverlay); wpfMap1.Refresh(); }
/// <summary> /// Add the Bing Maps layer to the map /// </summary> private void btnActivate_Click(object sender, EventArgs e) { // Create the layer overlay with some additional settings and add to the map. LayerOverlay layerOverlay = new LayerOverlay(); mapView.Overlays.Add("Bing Map", layerOverlay); // Create the bing map layer and add it to the map. BingMapsLayer bingMapsLayer = new BingMapsLayer(txtApplicationID.Text, BingMapsMapType.Road); bingMapsLayer.TileCache = new FileRasterTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache/bing_maps")); layerOverlay.Layers.Add(bingMapsLayer); // Refresh the map. mapView.Refresh(); }
private void LoadBingMapsLayer() { // Please set your own information about those parameters below. string applicationID = "Your ApplicationID"; string cacheDirectory = @"c:\temp\"; BingMapsLayer worldLayer = new BingMapsLayer(applicationID, BingMapsMapType.Road, cacheDirectory); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("WorldLayer", worldLayer); winformsMap1.Overlays.Add(staticOverlay); winformsMap1.MapUnit = GeographyUnit.Meter; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); winformsMap1.CurrentExtent = new RectangleShape(-10000000, 10000000, 10000000, -10000000); winformsMap1.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { // Please set your own information about those parameters below. string applicationID = "Amg9BxyuF81NEyxKm2ESMaoL03MTvaYBV3KOfxpHeXDsEt38DVwK4-SPFPg6qcBp"; //string applicationID = "Your ApplicationID"; string cacheDirectory = @"c:\temp\"; BingMapsLayer worldLayer = new BingMapsLayer(applicationID, BingMapsMapType.Road, cacheDirectory); mapView.MapUnit = GeographyUnit.Meter; mapView.CurrentExtent = new RectangleShape(-10000000, 10000000, 10000000, -10000000); LayerOverlay worldOverlay = new LayerOverlay() { TileWidth = 256, TileHeight = 256 }; worldOverlay.Layers.Add("WorldLayer", worldLayer); mapView.ZoomLevelSet = new BingMapsZoomLevelSet(256); mapView.Overlays.Add("WorldOverlay", worldOverlay); mapView.Refresh(); }
internal static void AddBaseOverlays(WpfMap map, SimplifyMapPrinterLayer mapPrinterLayer) { var osmOverlay = map.Overlays.OfType <OpenStreetMapOverlay>().FirstOrDefault(); if (osmOverlay != null && osmOverlay.IsVisible) { OpenStreetMapLayer osmLayer = new OpenStreetMapLayer(); osmLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException; osmLayer.TimeoutInSeconds = 5; osmLayer.DrawingException += new EventHandler <DrawingExceptionLayerEventArgs>(osmLayer_DrawingException); mapPrinterLayer.Layers.Add(osmLayer); } var bingOverlay = map.Overlays.OfType <BingMapsOverlay>().FirstOrDefault(); if (bingOverlay != null && bingOverlay.IsVisible) { BingMapsLayer bingMapsLayer = new BingMapsLayer(bingOverlay.ApplicationId, (Layers.BingMapsMapType)bingOverlay.MapType); bingMapsLayer.TileCache = null; bingMapsLayer.TimeoutInSeconds = 5; bingMapsLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException; bingMapsLayer.DrawingException += new EventHandler <DrawingExceptionLayerEventArgs>(BingMapsLayer_DrawingException); mapPrinterLayer.Layers.Add(bingMapsLayer); } var wmlkOverlay = map.Overlays.OfType <WorldMapKitMapOverlay>().FirstOrDefault(); if (wmlkOverlay != null && wmlkOverlay.IsVisible) { WorldMapKitLayer worldMapKitLayer = new WorldMapKitLayer(wmlkOverlay.ClientId, wmlkOverlay.PrivateKey); worldMapKitLayer.TimeoutInSecond = 5; worldMapKitLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException; worldMapKitLayer.DrawingException += new EventHandler <DrawingExceptionLayerEventArgs>(WorldMapKitLayer_DrawingException); worldMapKitLayer.TileCache = null; worldMapKitLayer.Projection = wmlkOverlay.Projection; mapPrinterLayer.Layers.Add(worldMapKitLayer); } }