Ejemplo n.º 1
0
        public void GetTrafficIncidentTile()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new TrafficIncidentTileRequest
            {
                Style = TrafficIncidentTileStyle.s1,
                Zoom  = 12,
                X     = 2044,
                Y     = 1360
            };

            var r = am.GetTrafficIncidentTile(req).Result;

            Assert.Null(r.Error);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This API provides information on traffic incidents inside a given bounding box, based on the current Traffic Model ID. The Traffic Model ID is available to grant synchronization of data between calls and API's. The Traffic Model ID is a key value for determining the currency of traffic incidents. It is updated every minute, and is valid for two minutes before it times out. It is used in rendering traffic tiles. It can be obtained from the Viewport API.
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public virtual async Task <Response <byte[]> > GetTrafficIncidentTile(TrafficIncidentTileRequest req)
        {
            try
            {
                Url = string.Empty;
                var baseAddress = "https://atlas.microsoft.com/traffic/incident/tile/png";
                Url += GetQuery <TrafficIncidentTileRequest>(req, true);

                var content = await GetByteArray(baseAddress, Url);

                var response = Response <byte[]> .CreateResponse(content);

                return(response);
            }
            catch (AzureMapsException ex)
            {
                return(Response <byte[]> .CreateErrorResponse(ex));
            }
        }