Пример #1
0
    private string GetImagery(string locationString)
    {
        string        key           = "ArLeGdHOcc5h7j3L4W37oFGcU9E-LF3tAZi4o0DfhXbPJ8aiyTGbIDNHex08R2u7";
        MapUriRequest mapUriRequest = new MapUriRequest();

        // Set credentials using a valid Bing Maps key
        mapUriRequest.Credentials = new ImageryService.Credentials();
        mapUriRequest.Credentials.ApplicationId = key;

        // Set the location of the requested image
        mapUriRequest.Center = new ImageryService.Location();
        string[] digits = locationString.Split(',');
        mapUriRequest.Center.Latitude  = double.Parse(digits[0].Trim());
        mapUriRequest.Center.Longitude = double.Parse(digits[1].Trim());

        // Set the map style and zoom level
        MapUriOptions mapUriOptions = new MapUriOptions();

        mapUriOptions.Style     = MapStyle.AerialWithLabels;
        mapUriOptions.ZoomLevel = 17;

        // Set the size of the requested image in pixels
        mapUriOptions.ImageSize        = new ImageryService.SizeOfint();
        mapUriOptions.ImageSize.Height = 200;
        mapUriOptions.ImageSize.Width  = 300;

        mapUriRequest.Options = mapUriOptions;

        //Make the request and return the URI
        ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
        MapUriResponse       mapUriResponse = imageryService.GetMapUri(mapUriRequest);

        return(mapUriResponse.Uri);
    }
Пример #2
0
        //The Imagery Service
        private string GetImagery(string locationString)
        {
            string        key           = "ApwndqJgdJ9M1Bpb7d_ihBwXW-J0N3HdXrZvFZqvFtmeYN5DewRoGPI7czgFo5Sh";
            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps key
            mapUriRequest.Credentials = new ImageryService.Credentials();
            mapUriRequest.Credentials.ApplicationId = key;

            // Set the location of the requested image
            mapUriRequest.Center = new ImageryService.Location();
            string[] digits = locationString.Split(',');
            mapUriRequest.Center.Latitude  = double.Parse(digits[0].Trim());
            mapUriRequest.Center.Longitude = double.Parse(digits[1].Trim());

            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();

            mapUriOptions.Style     = MapStyle.AerialWithLabels;
            mapUriOptions.ZoomLevel = 17;

            // Set the size of the requested image in pixels
            mapUriOptions.ImageSize        = new ImageryService.SizeOfint();
            mapUriOptions.ImageSize.Height = 200;
            mapUriOptions.ImageSize.Width  = 300;

            mapUriRequest.Options = mapUriOptions;

            //Make the request and return the URI
            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse       mapUriResponse = imageryService.GetMapUri(mapUriRequest);

            return(mapUriResponse.Uri);
        }
Пример #3
0
        private string GetMapUri(double latitude, double longitude, int zoom, string mapStyle, int width, int height)
        {
            MvcSourceblog.ImageryServices.Pushpin[] pins    = new MvcSourceblog.ImageryServices.Pushpin[1];
            MvcSourceblog.ImageryServices.Pushpin   pushpin = new MvcSourceblog.ImageryServices.Pushpin();
            pushpin.Location           = new MvcSourceblog.ImageryServices.Location();
            pushpin.Location.Latitude  = latitude;
            pushpin.Location.Longitude = longitude;
            pushpin.IconStyle          = "2";
            pins[0] = pushpin;
            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps Key
            mapUriRequest.Credentials = new ImageryServices.Credentials();
            mapUriRequest.Credentials.ApplicationId = "AhjlMbKnHDlgTASkyk750YRs5wR3_1gN2hEz6pahnE7Iiurq_DzrE4hDUgBxrtfN";


            // Set the location of the requested image
            mapUriRequest.Pushpins = pins;
            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();

            //mapUriOptions.ZoomLevel = 17;
            switch (mapStyle.ToUpper())
            {
            case "HYBRID":
                mapUriOptions.Style = MvcSourceblog.ImageryServices.MapStyle.AerialWithLabels;
                break;

            case "ROAD":
                mapUriOptions.Style = MvcSourceblog.ImageryServices.MapStyle.Road;
                break;

            case "AERIAL":
                mapUriOptions.Style = MvcSourceblog.ImageryServices.MapStyle.Aerial;
                break;

            case "BirdseyeWithLabels_v1":
                mapUriOptions.Style = MvcSourceblog.ImageryServices.MapStyle.BirdseyeWithLabels_v1;
                break;

            default:
                mapUriOptions.Style = MvcSourceblog.ImageryServices.MapStyle.Road;
                break;
            }

            mapUriOptions.ZoomLevel = 10;
            // Set the size of the requested image to match the size of the image control
            mapUriOptions.ImageSize        = new MvcSourceblog.ImageryServices.SizeOfint();
            mapUriOptions.ImageSize.Height = height;
            mapUriOptions.ImageSize.Width  = width;
            mapUriRequest.Options          = mapUriOptions;

            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse       mapUriResponse = imageryService.GetMapUri(mapUriRequest);

            return(mapUriResponse.Uri);
        }
Пример #4
0
        async public static Task <string> GetMapUri(double latitude, double longitude, int zoom, string mapStyle, int width, int height)
        {
            var pins    = new Pushpin[1];
            var pushpin = new Pushpin();

            pushpin.Location           = new Location();
            pushpin.Location.Latitude  = latitude;
            pushpin.Location.Longitude = longitude;
            pushpin.IconStyle          = "2";
            pins[0] = pushpin;

            var mapUriRequest = new MapUriRequest
            {
                Credentials = new Credentials(),
                Pushpins    = pins
            };

            mapUriRequest.Credentials.ApplicationId = App.Self.APIKEY;

            var mapUriOptions = new MapUriOptions
            {
                ZoomLevel = zoom,
                ImageSize = new SizeOfint()
            };

            switch (mapStyle.ToUpper())
            {
            case "HYBRID":
                mapUriOptions.Style = MapStyle.AerialWithLabels;
                break;

            case "ROAD":
                mapUriOptions.Style = MapStyle.Road;
                break;

            case "AERIAL":
                mapUriOptions.Style = MapStyle.Aerial;
                break;

            default:
                mapUriOptions.Style = MapStyle.Road;
                break;
            }

            mapUriOptions.ImageSize.Height = height;
            mapUriOptions.ImageSize.Width  = width;

            mapUriRequest.Options = mapUriOptions;

            var            imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse mapUriResponse = imageryService.GetMapUriAsync(mapUriRequest);

            return(mapUriResponse.Uri);
        }
Пример #5
0
        private string GetMapUri(double latitude, double longitude, int zoom, string mapStyle, int width, int height)
        {
            ImageryServices.Pushpin[] pins    = new ImageryServices.Pushpin[1];
            ImageryServices.Pushpin   pushpin = new ImageryServices.Pushpin();
            pushpin.Location           = new ImageryServices.Location();
            pushpin.Location.Latitude  = latitude;
            pushpin.Location.Longitude = longitude;
            pushpin.IconStyle          = "2";
            pins[0] = pushpin;
            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps Key
            mapUriRequest.Credentials = new ImageryServices.Credentials();
            mapUriRequest.Credentials.ApplicationId = "7Xe5dWLJW6JIhH6jDYR7~6wrgqqAAstaYhxwKEyAB6g~AhB0MhPMBgrTWhG-cxBqbFxaJe92xk7oGVnJPfBckupM4wWTauJQIMkjs5Fs_Z5u";

            // Set the location of the requested image
            mapUriRequest.Pushpins = pins;
            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();

            //mapUriOptions.ZoomLevel = 17;
            switch (mapStyle.ToUpper())
            {
            case "HYBRID":
                mapUriOptions.Style = ImageryServices.MapStyle.AerialWithLabels;
                break;

            case "ROAD":
                mapUriOptions.Style = ImageryServices.MapStyle.Road;
                break;

            case "AERIAL":
                mapUriOptions.Style = ImageryServices.MapStyle.Aerial;
                break;

            default:
                mapUriOptions.Style = ImageryServices.MapStyle.Road;
                break;
            }

            mapUriOptions.ZoomLevel = 15;
            // Set the size of the requested image to match the size of the image control
            mapUriOptions.ImageSize        = new ImageryServices.SizeOfint();
            mapUriOptions.ImageSize.Height = height;
            mapUriOptions.ImageSize.Width  = width;
            mapUriRequest.Options          = mapUriOptions;

            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse       mapUriResponse = imageryService.GetMapUri(mapUriRequest);

            return(mapUriResponse.Uri);
        }
        public string GetMapUri(double latitude, double longitude, int zoom, string mapStyle, int width, int height)
        {
            ImageryService.Pushpin[] pins    = new ImageryService.Pushpin[1];
            ImageryService.Pushpin   pushpin = new ImageryService.Pushpin();
            pushpin.Location           = new ImageryService.Location();
            pushpin.Location.Latitude  = latitude;
            pushpin.Location.Longitude = longitude;
            pushpin.IconStyle          = "2";
            pins[0] = pushpin;
            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps Key
            mapUriRequest.Credentials = new ImageryService.Credentials();
            mapUriRequest.Credentials.ApplicationId = "AjKX5fPclkvH3YTYhLImWMour1KISHMrcFVBrXzVsjqwMLiWobOq83esCN1ra0Q0";

            // Set the location of the requested image
            mapUriRequest.Pushpins = pins;
            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();

            //mapUriOptions.ZoomLevel = 17;
            switch (mapStyle.ToUpper())
            {
            case "HYBRID":
                mapUriOptions.Style = ImageryService.MapStyle.AerialWithLabels;
                break;

            case "ROAD":
                mapUriOptions.Style = ImageryService.MapStyle.Road;
                break;

            case "AERIAL":
                mapUriOptions.Style = ImageryService.MapStyle.Aerial;
                break;

            default:
                mapUriOptions.Style = ImageryService.MapStyle.Road;
                break;
            }

            mapUriOptions.ZoomLevel = 10;
            // Set the size of the requested image to match the size of the image control
            mapUriOptions.ImageSize        = new ImageryService.SizeOfint();
            mapUriOptions.ImageSize.Height = height;
            mapUriOptions.ImageSize.Width  = width;
            mapUriRequest.Options          = mapUriOptions;

            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse       mapUriResponse = imageryService.GetMapUri(mapUriRequest);

            return(mapUriResponse.Uri);
        }
Пример #7
0
    public static BitmapImage GetImagery(XYPoint point, double dx, double dy)
    {
      
      try
      {
        string key = "ArfYQbvMgvi7NOpxSAuS3lkBlVc3NqzgBcVo-yxNyr_KPVJbhwR22c9cVfG7AnwY";
        MapUriRequest mapUriRequest = new MapUriRequest();

        // Set credentials using a valid Bing Maps key
        mapUriRequest.Credentials = new Credentials();
        mapUriRequest.Credentials.ApplicationId = key;

        // Set the location of the requested image
        mapUriRequest.Center = new Location();
        mapUriRequest.Center.Latitude = point.Latitude;
        mapUriRequest.Center.Longitude = point.Longitude;

        // Set the map style and zoom level
        MapUriOptions mapUriOptions = new MapUriOptions();
        mapUriOptions.Style = MapStyle.AerialWithLabels_v1;
        mapUriOptions.ZoomLevel = 13;

        // Set the size of the requested image in pixels
        mapUriOptions.ImageSize = new SizeOfint();
        mapUriOptions.ImageSize.Height = (int)(dy / 19.11); //19.11 to get meters
        mapUriOptions.ImageSize.Width = (int)(dx / 19.11);


        mapUriRequest.Options = mapUriOptions;
        //Make the request and return the URI
        ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
        MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);
        return new BitmapImage(new Uri(mapUriResponse.Uri));      
      }
      catch (Exception e)
      {
        return null;
      }
    }
Пример #8
0
        public static BitmapImage GetImagery(XYPoint point, double dx, double dy)
        {
            try
            {
                string        key           = "ArfYQbvMgvi7NOpxSAuS3lkBlVc3NqzgBcVo-yxNyr_KPVJbhwR22c9cVfG7AnwY";
                MapUriRequest mapUriRequest = new MapUriRequest();

                // Set credentials using a valid Bing Maps key
                mapUriRequest.Credentials = new Credentials();
                mapUriRequest.Credentials.ApplicationId = key;

                // Set the location of the requested image
                mapUriRequest.Center           = new Location();
                mapUriRequest.Center.Latitude  = point.Latitude;
                mapUriRequest.Center.Longitude = point.Longitude;

                // Set the map style and zoom level
                MapUriOptions mapUriOptions = new MapUriOptions();
                mapUriOptions.Style     = MapStyle.AerialWithLabels_v1;
                mapUriOptions.ZoomLevel = 13;

                // Set the size of the requested image in pixels
                mapUriOptions.ImageSize        = new SizeOfint();
                mapUriOptions.ImageSize.Height = (int)(dy / 19.11); //19.11 to get meters
                mapUriOptions.ImageSize.Width  = (int)(dx / 19.11);


                mapUriRequest.Options = mapUriOptions;
                //Make the request and return the URI
                ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
                MapUriResponse       mapUriResponse = imageryService.GetMapUri(mapUriRequest);
                return(new BitmapImage(new Uri(mapUriResponse.Uri)));
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Пример #9
0
        private string GetImagery(string locationString)
        {
            string        key           = "AnMBF3YY-9Cu2a6Og_vid1aCqNpho_WUux8hnOKgtYAK7zFR-WUtXXz31fxPNaCP";
            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps key
            mapUriRequest.Credentials = new ImageryService.Credentials();
            mapUriRequest.Credentials.ApplicationId = key;

            // Set the location of the requested image
            mapUriRequest.Center = new ImageryService.Location();
            string[] digits = locationString.Split(',');
            mapUriRequest.Center.Latitude  = double.Parse(digits[0].Trim());
            mapUriRequest.Center.Longitude = double.Parse(digits[1].Trim());

            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();

            mapUriOptions.Style     = MapStyle.AerialWithLabels;
            mapUriOptions.ZoomLevel = 13;

            // Set the size of the requested image in pixels
            mapUriOptions.ImageSize        = new ImageryService.SizeOfint();
            mapUriOptions.ImageSize.Height = 400;
            mapUriOptions.ImageSize.Width  = 600;

            mapUriRequest.Options = mapUriOptions;



            //Make the request and return the URI
            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse       mapUriResponse = imageryService.GetMapUri(mapUriRequest);

            return(mapUriResponse.Uri);
        }
        private string GetImagery(string locationString)
        {
            string key = "l4o5yybDpLNG7xrsTmoP~A0DSZhcYTwcaKvEUgBi44g~AsAjqiCU7gZND03eLCfpdqNDGFXfMdzqXYLFVEGnFy1SgQSlDA8ld0BpbCgI4JsD";
            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps key
            mapUriRequest.Credentials = new ImageryService.Credentials();
            mapUriRequest.Credentials.ApplicationId = key;

            // Set the location of the requested image
            mapUriRequest.Center = new ImageryService.Location();

            GeocodeService.Location loc = this.GeocodeAddressGetLocation(locationString);

            if (loc != null)
            {
                mapUriRequest.Center.Latitude = loc.Latitude;
                mapUriRequest.Center.Longitude = loc.Longitude;
            }

            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();
            mapUriOptions.Style = MapStyle.Road;
            mapUriOptions.ZoomLevel = 15;

            // Set the size of the requested image in pixels
            mapUriOptions.ImageSize = new ImageryService.SizeOfint();
            mapUriOptions.ImageSize.Height = 500;
            mapUriOptions.ImageSize.Width = 500;

            mapUriRequest.Options = mapUriOptions;

            //Make the request and return the URI
            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);
            return mapUriResponse.Uri;
        }
Пример #11
0
        public string GetMapUri(double latitude, double longitude, int zoom, string mapStyle, int width, int height)
        {
            ImageryService.Pushpin[] pins = new ImageryService.Pushpin[1];
            ImageryService.Pushpin pushpin = new ImageryService.Pushpin();
            pushpin.Location = new ImageryService.Location();
            pushpin.Location.Latitude = latitude;
            pushpin.Location.Longitude = longitude;
            pushpin.IconStyle = "2";

            pins[0] = pushpin;

            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps Key
            mapUriRequest.Credentials = new ImageryService.Credentials();
            mapUriRequest.Credentials.ApplicationId = key;

            // Set the location of the requested image
            mapUriRequest.Pushpins = pins;

            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();

            switch (mapStyle.ToUpper())
            {
                case "HYBRID":
                    mapUriOptions.Style = ImageryService.MapStyle.AerialWithLabels;
                    break;
                case "ROAD":
                    mapUriOptions.Style = ImageryService.MapStyle.Road;
                    break;
                case "AERIAL":
                    mapUriOptions.Style = ImageryService.MapStyle.Aerial;
                    break;
                default:
                    mapUriOptions.Style = ImageryService.MapStyle.Road;
                    break;
            }

            mapUriOptions.ZoomLevel = zoom;

            // Set the size of the requested image to match the size of the image control
            mapUriOptions.ImageSize = new ImageryService.SizeOfint();
            mapUriOptions.ImageSize.Height = height;
            mapUriOptions.ImageSize.Width = width;

            mapUriRequest.Options = mapUriOptions;

            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);

            return mapUriResponse.Uri;
        }
Пример #12
0
        //private GeocodeService.Location GeocodeAddress(string address)
        //{
        //    GeocodeRequest geocodeRequest = new GeocodeRequest();
        //    // Set the credentials using a valid Bing Maps Key
        //    geocodeRequest.Credentials = new GeocodeService.Credentials();
        //    geocodeRequest.Credentials.ApplicationId = key;
        //    // Set the full address query
        //    geocodeRequest.Query = address;
        //    // Set the options to only return high confidence results
        //    ConfidenceFilter[] filters = new ConfidenceFilter[1];
        //    filters[0] = new ConfidenceFilter();
        //    filters[0].MinimumConfidence = GeocodeService.Confidence.High;
        //    GeocodeOptions geocodeOptions = new GeocodeOptions();
        //    geocodeOptions.Filters = filters;
        //    geocodeRequest.Options = geocodeOptions;
        //    // Make the geocode request
        //    GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
        //    GeocodeResponse geocodeResponse = geocodeService.Geocode(geocodeRequest);
        //    if (geocodeResponse.Results.Length > 0)
        //        if (geocodeResponse.Results[0].Locations.Length > 0)
        //            return geocodeResponse.Results[0].Locations[0];
        //    return null;
        //}
        public string GetImagery(string locationString)
        {
            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps key
            mapUriRequest.Credentials = new ImageryService.Credentials();
            mapUriRequest.Credentials.ApplicationId = key;

            // Set the location of the requested image
            mapUriRequest.Center = new ImageryService.Location();
            string[] digits = locationString.Split(',');
            mapUriRequest.Center.Latitude = double.Parse(digits[0].Trim());
            mapUriRequest.Center.Longitude = double.Parse(digits[1].Trim());

            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();
            mapUriOptions.Style = MapStyle.AerialWithLabels;
            mapUriOptions.ZoomLevel = 17;

            // Set the size of the requested image in pixels
            mapUriOptions.ImageSize = new ImageryService.SizeOfint();
            mapUriOptions.ImageSize.Height = 200;
            mapUriOptions.ImageSize.Width = 300;

            mapUriRequest.Options = mapUriOptions;

            //Make the request and return the URI
            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");
            MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);
            return mapUriResponse.Uri;
        }
Пример #13
0
        public static void LoadMap(EventHandler<GetMapUriCompletedEventArgs> callback, double latitude, double longitude, int width, int height)
        {
            if(string.IsNullOrEmpty(ApplicationId))
            {
                MessageBox.Show("You need to get bing maps developer id http://www.bing.com/developers");
                return;
            }

            MapUriRequest mapUriRequest = new MapUriRequest();

            // Set credentials using a valid Bing Maps Key
            mapUriRequest.Credentials = new Credentials();
            mapUriRequest.Credentials.ApplicationId = ApplicationId;

            // Set the location of the requested image
            mapUriRequest.Center = new dev.virtualearth.net.webservices.v1.common.Location();
            mapUriRequest.Center.Latitude = latitude;
            mapUriRequest.Center.Longitude = longitude;

            // Set the map style and zoom level
            MapUriOptions mapUriOptions = new MapUriOptions();
            mapUriOptions.Style = MapStyle.Road;
            mapUriOptions.ZoomLevel = 16;

            // Set the size of the requested image to match the size of the image control
            mapUriOptions.ImageSize = new SizeOfint();
            mapUriOptions.ImageSize.Height = height;
            mapUriOptions.ImageSize.Width = width;

            mapUriRequest.Options = mapUriOptions;

            ImageryServiceClient imageryService = new ImageryServiceClient("BasicHttpBinding_IImageryService");

            // Make the image request
            imageryService.GetMapUriCompleted += callback;
            imageryService.GetMapUriAsync(mapUriRequest);
        }
Пример #14
0
        /// <summary>
        /// Get Bing Map Image
        /// </summary>
        protected override void GetMapInternal()
        {
            try
            {
                MapUriOptions mapUriOptions = new MapUriOptions
                {
                    Style = Satellite ? MapStyle.AerialWithLabels : MapStyle.Road,
                    StyleSpecified = true,
                    ZoomLevel = Zoom,
                    ZoomLevelSpecified = true,
                    ImageType = ImageType.Jpeg,
                    ImageTypeSpecified = true,
                    ImageSize = new SizeOfint
                    {
                        Width = Width,
                        WidthSpecified = true,
                        Height = Height,
                        HeightSpecified = true
                    }
                };
                MapUriRequest mapUriRequest = new MapUriRequest
                {
                    Credentials = new Credentials
                    {
                        Token = TokenService.GetToken(Username, Password)
                    },
                    Center = new Location
                    {
                        Latitude = Latitude,
                        LatitudeSpecified = true,
                        Longitude = Longitude,
                        LongitudeSpecified = true
                    },
                    Options = mapUriOptions
                };
                using (ImageryService imageryService = new ImageryService())
                {
                    MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);
                    Log.Info("MapService.GetMap", "URL: {0}", mapUriResponse.Uri);

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(mapUriResponse.Uri);
                    request.Credentials = new NetworkCredential(Username, Password);
                    request.AllowAutoRedirect = true;
                    request.ReadWriteTimeout = 5000;
                    request.Method = "GET";
                    request.Timeout = 5000;
                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    {
                        using (Stream stream = response.GetResponseStream())
                        {
                            if (MapDownloaded != null)
                            {
                                MapDownloaded(this, new MapEventArgs(new Bitmap(stream), true));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception("MapService.GetMap", "Exception: {0}", ex.Message);
                if (MapDownloaded != null)
                {
                    MapDownloaded(this, new MapEventArgs(null, false));
                }
            }
        }