【发布时间】:2013-03-04 15:03:12
【问题描述】:
我最近开始在 c# 中的 webService [wcf] 中使用 [Bing Api]。 我想用必应恢复给定比例的卫星图像! 例如
比例 1:200(地图上的 1 厘米等于世界上的 200 厘米)
当然,我找到了解释如何计算图像分辨率卫星 bing 的这个函数,但这不是我想要的 ..
Map resolution = 156543.04 meters/pixel * cos(latitude) / (2 ^ zoomlevel)
这是我用来生成我的 bing 地图的函数,但我不知道要发送什么参数来检索 1:200 的图像比例。
我需要:
比例 = 1:200
我搜索:
int mapSizeHeight = ?
int mapSizeWidth = ?
int zoomLevel = ?
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;
}
【问题讨论】:
标签: map geolocation bing-maps bing-api