public void GetMapImage() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); var req = new MapImageRequest { Format = AzureMapsToolkit.Render.RasterTileFormat.png, Layer = StaticMapLayer.basic, Zoom = 2, Center = "62,17" }; var content = am.GetMapImage(req).Result; Assert.NotEmpty(content.Result); }
/// <summary> /// /// </summary> /// <param name="lon"> Longitude for the center. </param> /// <param name="lat"> Latitude for the center. </param> /// <param name="zoom"> Amount of zoom applied. </param> /// <param name="blobName"> Blobname, which will be passed into the returning struct. </param> /// <returns> ImageFile struct containing the image, the blobname reserved for it and the content type. </returns> public ImageFile GetMapImage(double lon, double lat, int zoom, string blobName) { var am = new AzureMapsToolkit.AzureMapsServices(config.Key); var req = new MapImageRequest { Format = AzureMapsToolkit.Render.RasterTileFormat.png, Layer = StaticMapLayer.basic, Zoom = zoom, Center = $"{lon},{lat}" }; // Fetch the image Response <byte[]> content = am.GetMapImage(req).Result; byte[] bytes = content.Result; return(new ImageFile(blobName, bytes, "image/png")); }