public static SharpMap.Map InitializeGoogleMap(GoogleMapType mt) { SharpMap.Map map = new SharpMap.Map(); GoogleRequest req; ITileSource tileSource; TileAsyncLayer tileLayer; if (mt == (GoogleMapType.GoogleSatellite | GoogleMapType.GoogleLabels)) { req = new GoogleRequest(GoogleMapType.GoogleSatellite); tileSource = new GoogleTileSource(req); tileLayer = new TileAsyncLayer(tileSource, "TileLayer - " + GoogleMapType.GoogleSatellite); map.Layers.Add(tileLayer); req = new GoogleRequest(GoogleMapType.GoogleLabels); tileSource = new GoogleTileSource(req); mt = GoogleMapType.GoogleLabels; } else { req = new GoogleRequest(mt); tileSource = new GoogleTileSource(req); } tileLayer = new TileAsyncLayer(tileSource, "TileLayer - " + mt); map.BackgroundLayer.Add(tileLayer); map.ZoomToBox(tileLayer.Envelope); return map; }
public GoogleTileSource(GoogleRequest request, IPersistentCache <byte[]> persistentCache = null) { _tileSchema = new SphericalMercatorInvertedWorldSchema(); _provider = new HttpTileProvider(request, persistentCache, // The Google requests needs to fake the UserAgent en Referer. uri => { var httpWebRequest = (HttpWebRequest)WebRequest.Create(uri); httpWebRequest.UserAgent = UserAgent; httpWebRequest.Referer = Referer; return(RequestHelper.FetchImage(httpWebRequest)); }); }
public GoogleTileSource(GoogleRequest request, IPersistentCache<byte[]> persistentCache = null) { _tileSchema = new SphericalMercatorInvertedWorldSchema(); _tileProvider = new WebTileProvider(request, persistentCache, // The Google requests needs to fake the UserAgent en Referer. uri => { var httpWebRequest = (HttpWebRequest) WebRequest.Create(uri); httpWebRequest.UserAgent = UserAgent; httpWebRequest.Referer = Referer; return httpWebRequest; }); }
private static Map InitializeMapGoogle(GoogleMapType mt) { Map map = new Map(); GoogleRequest req; ITileSource tileSource; TileLayer tileLayer; if (mt == (GoogleMapType.GoogleSatellite | GoogleMapType.GoogleLabels)) { req = new GoogleRequest(GoogleMapType.GoogleSatellite); tileSource = new GoogleTileSource(req); tileLayer = new TileLayer(tileSource, "TileLayer - " + GoogleMapType.GoogleSatellite); map.Layers.Add(tileLayer); req = new GoogleRequest(GoogleMapType.GoogleLabels); tileSource = new GoogleTileSource(req); mt = GoogleMapType.GoogleLabels; } else { req = new GoogleRequest(mt); tileSource = new GoogleTileSource(req); } tileLayer = new TileLayer(tileSource, "TileLayer - " + mt); map.Layers.Add(tileLayer); map.ZoomToBox(tileLayer.Envelope); return map; }
public GoogleTileSource(GoogleRequest request, ITileCache <byte[]> fileCache) { _tileSchema = new SphericalMercatorInvertedWorldSchema(); _tileProvider = new WebTileProvider(request, fileCache, UserAgent, Referer, true); }
public GoogleTileSource(GoogleRequest request) : this(request, new NullCache()) { }