public BingLayerConfiguration(string fileCacheRoot, BingMapType bingMapType, string bingToken = null) : base(BruTileLayerPlugin.Settings.PermaCacheType, fileCacheRoot) { _bingMapType = bingMapType; _bingToken = bingToken; var url = string.IsNullOrEmpty(bingToken) ? BingRequest.UrlBingStaging : BingRequest.UrlBing; TileSource = new BingTileSource(url, bingToken, bingMapType); //TileSource.Schema.Resolutions.RemoveAt(0); //var s = TileSource.Schema as TileSchema; //s.Axis = AxisDirection.Normal; //s.OriginY = 0; //s.Extent = new Extent(s.Extent.MinX, 0, s.Extent.MaxX, s.Extent.MaxY); TileCache = CreateTileCache(); }
public void TestIncompleteImage() { using (var map = new SharpMap.Map(new Size(2500, 2500))) { map.BackColor = Color.Magenta; var br = new BingRequest(BingRequest.UrlBing, "", BingMapType.Hybrid); var bts = new BingTileSource(br); var tl = new TileLayer(bts, "TileLayer - " + BingMapType.Hybrid.ToString(), Color.Transparent, true, System.IO.Path.Combine(_fileCacheRoot, "BingStaging")); map.Layers.Add(tl); map.ZoomToBox(new Envelope(829384.331338522, 837200.785470394, 7068020.31417922, 7072526.73926545) /*new Envelope(-239839.49199841652, 78451.759683380573, -37033.0152981899, 106723.52879865949)*/); using (var image = map.GetMap()) { image.Save("TestIncompleteImage.png", ImageFormat.Png); } } }
private bool InitializeBrutileProvider() { if (this.TileServerName.Equals(Properties.Resources.BingHybrid, StringComparison.InvariantCultureIgnoreCase)) { string token = String.Empty; string url = string.IsNullOrWhiteSpace(token) ? BingRequest.UrlBingStaging : BingRequest.UrlBing; TileSource = new BingTileSource(new BingRequest(url, string.Empty, BingMapType.Hybrid)); TileCache = new MemoryCache<byte[]>(100, 200); return true; } if (this.TileServerName.Equals(Properties.Resources.GoogleSatellite, StringComparison.InvariantCultureIgnoreCase)) { TileSource = new GoogleTileSource(GoogleMapType.GoogleSatellite); TileCache = new MemoryCache<byte[]>(100, 200); return true; } if (this.TileServerName.Equals(Properties.Resources.GoogleMap, StringComparison.InvariantCultureIgnoreCase)) { TileSource = new GoogleTileSource(GoogleMapType.GoogleMap); TileCache = new MemoryCache<byte[]>(100, 200); return true; } if (this.TileServerName.Equals(Properties.Resources.YahooMap, StringComparison.InvariantCultureIgnoreCase)) { /* TileSource = new YahooTileSource(YahooMapType.YahooMap); TileCache = new MemoryCache<byte[]>(100, 200); return true; */ } if (this.TileServerName.Equals(Properties.Resources.YahooSatellite, StringComparison.InvariantCultureIgnoreCase)) { /* TileSource = new YahooTileSource(YahooMapType.YahooSatellite); TileCache = new MemoryCache<byte[]>(100, 200); return true; */ } if (this.TileServerName.Equals(Properties.Resources.WMSMap, StringComparison.InvariantCultureIgnoreCase)) { TileSource = WmsTileSource.Create(WmsServerInfo); TileCache = new MemoryCache<byte[]>(100, 200); return true; } TileSource = null; TileCache = null; return false; }