Exemplo n.º 1
0
            public async static Task <Bitmap> GetHeatMap(List <MeteorBase> data)
            {
                Bitmap bitmapImage;

                try
                {
                    var requesParams = new HeatMapArgs()
                    {
                        Data = data,
                        Zoom = 1,
                    };
                    string target = CreateUrl(requesParams);

                    using (var response = await client.GetAsync(target))
                    {
                        response.EnsureSuccessStatusCode();

                        using (Stream stream = await response.Content.ReadAsStreamAsync())
                        {
                            bitmapImage = new Bitmap(stream);
                        }
                    }

                    return(bitmapImage);
                }
                catch
                {
                    throw;
                }
            }
Exemplo n.º 2
0
            private static string CreateUrl(HeatMapArgs args)
            {
                string baseUrl = "https://image.maps.api.here.com/mia/1.6/heat?";
                string credentialParameters = $"app_id={Credentials.AppId}&app_code={Credentials.AppCode}";
                string otherParams          = $"&z={args.Zoom}&h={args.Height}&w={args.Width}&op={args.Opacity}";

                string dataPoints = "";

                for (int i = 0; i < System.Math.Min(args.Data.Count, args.MaxDataCount); ++i)
                {
                    dataPoints += $"&a{i}={args.Data[i].PositionRaw}&rad{i}={args.Rad}&l{i}=1";
                }

                return(baseUrl + credentialParameters + otherParams + dataPoints);
            }