我最近开始在 c# 的 webService [wcf] 中使用[ Bing Api ]。我想用 Bing恢复给定比例的卫星图像!例如
比例 1:200(地图上的 1 厘米等于世界上的 200 厘米)
当然,我发现这个函数解释了如何计算图像分辨率卫星 bing 但这不是我要找的..
Map resolution = 156543.04 meters/pixel * cos(latitude) / (2 ^ zoomlevel)
这是我用来生成我的 bing 地图的函数,但我不知道要发送什么参数来检索 1:200 的图像比例。
我需要 :
比例 = 1:200
我搜索 :
诠释地图大小高度=?
int mapSizeWidth = ?
整数缩放级别= ?
public string GetImageMap(double latitude,double longitude,int mapSizeHeight, int mapSizeWidth, int zoomLevel)
{
string key = "ddsaAaasm5vwsdfsfd2ySYBxfEFsdfsdfcFh6iUO5GI4v";
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();
mapUriRequest.Center.Latitude = latitude;
mapUriRequest.Center.Longitude = longitude;
// Set the map style and zoom level
MapUriOptions mapUriOptions = new MapUriOptions();
mapUriOptions.Style = MapStyle.Aerial;
mapUriOptions.ZoomLevel = zoomLevel;
mapUriOptions.PreventIconCollision = true;
// Set the size of the requested image in pixels
mapUriOptions.ImageSize = new ImageryService.SizeOfint();
mapUriOptions.ImageSize.Height = mapSizeHeight;
mapUriOptions.ImageSize.Width = mapSizeWidth;
mapUriRequest.Options = mapUriOptions;
//Make the request and return the URI
ImageryServiceClient imageryService = new ImageryServiceClient();
MapUriResponse mapUriResponse = imageryService.GetMapUri(mapUriRequest);
return mapUriResponse.Uri;
}