in Source/Requests/ImageryRequest.cs [265:388]
public string GetPostRequestUrl()
{
var isQuery = !string.IsNullOrWhiteSpace(Query);
var isRoute = (Waypoints != null && Waypoints.Count >= 2);
var sb = new StringBuilder(this.Domain);
sb.Append("Imagery/Map/");
sb.Append(Enum.GetName(typeof(ImageryType), ImagerySet));
if (CenterPoint != null)
{
sb.AppendFormat(CultureInfo.InvariantCulture, "/{0:0.#####},{1:0.#####}/", CenterPoint.Latitude, CenterPoint.Longitude);
if (zoomLevel != 0)
{
sb.Append(zoomLevel);
}
else if (HighlightEntity)
{
sb.Append(Enum.GetName(typeof(EntityType), EntityType));
}
else if (ImagerySet == ImageryType.Road || ImagerySet == ImageryType.Aerial || ImagerySet == ImageryType.AerialWithLabels ||
ImagerySet == ImageryType.RoadOnDemand || ImagerySet == ImageryType.AerialWithLabelsOnDemand || ImagerySet == ImageryType.CanvasDark ||
ImagerySet == ImageryType.CanvasGray || ImagerySet == ImageryType.CanvasLight)
{
throw new Exception("Zoom Level must be specified when a centerPoint is specified and ImagerySet is Road, Aerial, AerialWithLabels, or any variation of these (Canvas/OnDemand).");
}
}
else if (isQuery)
{
sb.AppendFormat("/{0}", Uri.EscapeDataString(Query));
}
if (isRoute)
{
sb.AppendFormat("/Routes/{0}?", Enum.GetName(typeof(TravelModeType), (RouteOptions != null) ? RouteOptions.TravelMode : TravelModeType.Driving));
}
else
{
sb.Append("?");
}
sb.AppendFormat("ms={0},{1}", mapWidth, mapHeight);
if (DeclutterPins)
{
sb.Append("&dcl=1");
}
if (Format.HasValue)
{
sb.AppendFormat("&fmt={0}", Enum.GetName(typeof(ImageFormatType), Format.Value));
}
if (MapArea != null && (CenterPoint == null || !isRoute))
{
sb.AppendFormat("&ma={0}", MapArea.ToString());
}
if (ShowTraffic)
{
sb.Append("&ml=TrafficFlow");
}
if (GetMetadata)
{
sb.Append("&mmd=1");
}
if (HighlightEntity)
{
sb.Append("&he=1");
}
if(Resolution == ImageResolutionType.High)
{
sb.Append("&dpi=Large");
}
//Routing Parameters
if (isRoute)
{
if (Waypoints.Count > 25)
{
throw new Exception("More than 25 waypoints in route request.");
}
for (int i = 0; i < Waypoints.Count; i++)
{
sb.AppendFormat("&wp.{0}=", i);
if (Waypoints[i].Coordinate != null)
{
sb.AppendFormat(CultureInfo.InvariantCulture, "{0:0.#####},{1:0.#####}", Waypoints[i].Coordinate.Latitude, Waypoints[i].Coordinate.Longitude);
}
else
{
sb.AppendFormat("{0}", Uri.EscapeDataString(Waypoints[i].Address));
}
}
if (RouteOptions != null)
{
sb.Append(RouteOptions.GetUrlParam(0));
}
}
sb.Append(GetBaseRequestUrl());
if (!string.IsNullOrWhiteSpace(Style))
{
var s = CustomMapStyleManager.GetRestStyle(Style);
if (!string.IsNullOrWhiteSpace(s))
{
sb.AppendFormat("&st={0}", s);
}
}
return sb.ToString();
}