public async Task CreateHyperlapse(string outputFilePath)
        {
            Trace.TraceInformation("Retrieving street views...");
            var track = TrainingCenterXmlData.Courses[0].Track;

            for (int i = 1; i < track.Length; i++)
            {
                var previousPoint = track[i - 1];
                var currentPoint  = track[i];
                var heading       = CalculateHeading(previousPoint, currentPoint);
                var streetView    = await GoogleMapClient.GetStreetViewImage(currentPoint.Position.LatitudeDegrees, currentPoint.Position.LongitudeDegrees, heading);

                streetView.Save($"temp{i}.jpg");
            }

            Trace.TraceInformation("Rendering video...");
            FFMpegClient.ConvertMedia(new FFMpegInput[] { new FFMpegInput("temp%d.jpg")
                                                          {
                                                              CustomInputArgs = "-start_number 1 -framerate 3"
                                                          } }, outputFilePath, Format.mp4, new OutputSettings()
            {
                CustomOutputArgs = "-c:v libx264 -crf 18"
            });
        }
Beispiel #2
0
        static void TestGoogleMap()
        {
            var googleMapClient = new GoogleMapClient(
                new HttpClient(),
                new IntegrationConfig()
            {
                GoogleMap = new GoogleMapConfig()
                {
                }
            });

            var key = "AIzaSyCkGRsiXZWjOPLKDLgBbE8GEtzm0eRR-t8";

            var distanceMatrixRequest = new GoogleMap.Models.Routes.DistanceMatrix.DistanceMatrixRequest()
            {
                origins      = "Bệnh viện Thủ Đức",
                destinations = "Bệnh viện Quân Dân Y Miền Đông",
                language     = "vi"
            };

            var directionRequest = new DirectionRequest()
            {
                origin      = "Thành phố Quảng Ngãi",
                destination = "Thành phố Hồ Chí Minh",
                language    = "vi",
                waypoints   = "Thành phố Đà Lạt|Thành phố Vũng Tàu",
                mode        = GoogleMap.Models.Enum.Routes.TravelMode.Driving,
                units       = GoogleMap.Models.Enum.Routes.Unit.Imperial
            };

            var cities = new List <string>
            {
                "1 Lê Văn Việt, Hiệp Phú, Quận 9, Thành phố Hồ Chí Minh, Việt Nam",
                "141 Lê Văn Việt, Hiệp Phú, Quận 9, Thành phố Hồ Chí Minh, Việt Nam",
                "211 Lê Văn Việt, Quận 9, Thành phố Hồ Chí Minh, Việt Nam",
                "441 Lê Văn Việt, Tăng Nhơn Phú A, Quận 9, Thành phố Hồ Chí Minh, Việt Nam",
                // "Thành phố Bảo Lộc",
                // "Thành phố Đà Lạt",
            };

            var locations = new List <Location>()
            {
                // Thành phố Hồ Chí Minh
                new Location()
                {
                    lat = 10.8230989,
                    lng = 106.6296638
                },
                // Thành phố Vũng Tàu
                new Location()
                {
                    lat = 10.4113797,
                    lng = 107.136224
                },
                // Thành phố Biên Hòa
                new Location()
                {
                    lat = 10.9574128,
                    lng = 106.8426871
                },
                // Thành phố Phan Thiết
                new Location()
                {
                    lat = 10.9804603,
                    lng = 108.2614775
                },
                // Thành phố Bảo Lộc
                new Location()
                {
                    lat = 11.5731051,
                    lng = 107.8346924
                },
                // Thành phố Đà Lạt
                new Location()
                {
                    lat = 11.9404192,
                    lng = 108.4583132
                },
            };

            // TestGetDistanceMatrix(googleMapClient, distanceMatrixRequest);

            // TestGetDirection(googleMapClient, directionRequest);

            // TestInitMatrix(googleMapClient, cities);

            // var result = polyliner.Decode(polyline);

            // TestInitMatrixAsync(googleMapClient, cities);

            // TestFindPlace(googleMapClient, key);

            // TestNearbySearch(googleMapClient, key);

            // TestTextSearch(googleMapClient, key);

            // TestGetGeocoding(googleMapClient, key);

            // TestGetPlaceDetail(googleMapClient, key);

            // TestGetPlaceAutocomplete(googleMapClient, key);

            // TestGetQueryAutocomplete(googleMapClient, key);

            TestHamilton(googleMapClient, cities, key);
        }