public override string BuildImageRequestUrl(AerialImageData imageData, bool update = false)
        {
            // Get the format(jpeg / png)
            string format = GetFormatForMapType(imageData.MapType);

            // Scale is 2 no matter what. Always scale down width/height
            // to allow API to scale back up.
            int scale = 2;

            // If updating, reduce image width/height to original
            int width  = imageData.Width / (update ? 2 : 1);
            int height = imageData.Height / (update ? 2 : 1);

            string mapType;

            switch (imageData.MapType)
            {
            case MapType.Aerial:
                mapType = "satellite";
                break;

            case MapType.AerialWithLabels:
                mapType = "hybrid";
                break;

            default:
                mapType = "roadmap";
                break;
            }

            return(BaseGMapsUrl + $"center={imageData.Center.lat},{imageData.Center.lng}&zoom={imageData.Zoom}&size={width}x{height}" +
                   $"&format={format}&maptype={mapType}&scale={scale}&key={API_KEY}");
        }
示例#2
0
 public abstract string BuildImageRequestUrl(AerialImageData imageData, bool update = false);
 /// <summary>
 /// Builds the Bing Maps Static API request for an image.
 /// </summary>
 /// <param name="imageData">The image's data.</param>
 /// <returns></returns>
 public override string BuildImageRequestUrl(AerialImageData imageData, bool update = false)
 {
     return(BaseBingMapsUrl + $"{imageData.MapType}?" +
            $"mapArea={imageData.SWCorner.lat},{imageData.SWCorner.lng},{imageData.NECorner.lat},{imageData.NECorner.lng}" +
            $"&mapSize={imageData.Width},{imageData.Height}&key={API_KEY}");
 }