Пример #1
0
        public void GetTrafficFlowTile()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new TrafficFlowTileRequest
            {
                Style = TrafficFlowSegmentStyle.Absolute,
                Zoom  = 12,
                X     = 2044,
                Y     = 1360
            };

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

            Assert.Null(r.Error);
        }
Пример #2
0
        /// <summary>
        /// The Azure Flow Tile API serves 256 x 256 pixel tiles showing traffic flow. All tiles use the same grid system. Because the traffic tiles use transparent images, they can be layered on top of map tiles to create a compound display. The Flow tiles use colors to indicate either the speed of traffic on different road segments, or the difference between that speed and the free-flow speed on the road segment in question.
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>

        public virtual async Task <Response <byte[]> > GetTrafficFlowTile(TrafficFlowTileRequest req)
        {
            try
            {
                Url = string.Empty;
                var baseAddress = "https://atlas.microsoft.com/traffic/flow/tile/png";
                Url += GetQuery <TrafficFlowTileRequest>(req, true);

                var content = await GetByteArray(baseAddress, Url);

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

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