Пример #1
0
        public async Task GetCurrentCondition()
        {
            var am = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var q  = new GetCurrentConditionsRequest
            {
                Query = "47.641268,-122.125679",
                Unit  = Unit.imperial
            };
            var res = await am.GetCurrentCondition(q);

            Assert.Null(res.Error);
        }
Пример #2
0
        public async Task GetDailyForeCast()
        {
            var am = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var q  = new GetForecastRequest
            {
                Query = "62.6490341,30.0734812",
                Unit  = Unit.metric
            };
            var res = await am.GetDailyForecast(q);

            Assert.Null(res.Error);
        }
        public void GetGreatCircleDistance()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetGreatCircleDistance(new AzureMapsToolkit.Spatial.GreatCircleDistanceRequest
            {
                Query = "47.622942,-122.316456:47.610378,-122.200676"
            }).Result;

            Assert.Null(res.Error);

            Assert.Equal(8797.62, res.Result.Result.DistanceInMeters);
        }
        public void GetTransitLineInfo()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetTransitLineInfo(new AzureMapsToolkit.Mobility.TransitLineInfoRequest
            {
                MetroId    = 121,
                Query      = "373411",
                DetailType = TransitLineDetailType.Stops | TransitLineDetailType.Schedule | TransitLineDetailType.Stops
            }).Result;

            Assert.Null(res.Error);
        }
        public void GetCarShareInfo()
        {
            return;

            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetCarShareInfo(new AzureMapsToolkit.Mobility.CarShareInfoRequest
            {
                Query = ""
            }).Result;

            Assert.Null(res.Error);
        }
        public void Update()
        {
            return;

            var am = new AzureMapsToolkit.AzureMapsServices(_KEY);

            var json = "{\"type\": \"FeatureCollection\", \"features\": [{\"type\": \"Feature\",\"geometry\": {\"type\": \"Point\",\"coordinates\": [-122.126986, 47.639754]}, \"properties\": {\"geometryId\": \"001\",\"radius\": 500}}]}";
            var res  = am.Update(System.Guid.Parse(""), json).Result;

            Assert.NotNull(res.Result);
            Assert.Null(res.Error);
        }
        public void GetRouteRange()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new RouteRangeRequest
            {
                Query           = "52.50931,13.42936",
                TimeBudgetInSec = "12000"
            };
            var range = am.GetRouteRange(req).Result;

            Assert.NotNull(range.Result.ReachableRange.Boundary);
        }
        public void GetRouteDirections()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new RouteRequestDirections
            {
                Query = "52.50931,13.42936:52.50274,13.43872"
            };
            var directions = am.GetRouteDirections(req).Result;

            Assert.Null(directions.Error);
            Assert.NotNull(directions.Result);
        }
Пример #9
0
        public async Task GetDailyIndices()
        {
            var am = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var q  = new GetDailyIndicesRequest
            {
                Query = "43.84745,-79.37849",
                //IndexGroupId = 11
            };
            var res = await am.GetDailyIndices(q);

            Assert.Null(res.Error);
        }
Пример #10
0
        public void GetRouteDirectionsError()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new RouteRequestDirections
            {
                Query             = "52.50931,13.42936:52.50274,13.43872",
                VehicleEngineType = VehicleEngineType.Combustion
            };
            var directions = am.GetRouteDirections(req).Result;

            Assert.NotNull(directions.Error);
        }
Пример #11
0
        public async Task GetElevationDataForBoundingBox()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new AzureMapsToolkit.Elevation.GetElevationDataForBoundingBoxRequest
            {
                Bounds  = "-121.66853362143818, 46.84646479863713,-121.65853362143818, 46.8564647986371",
                Rows    = 2,
                Columns = 3
            };
            var res = await am.GetElevationDataForBoundingBox(req);

            Assert.Null(res.Error);
        }
Пример #12
0
        public async Task GetTimezoneWindowsToIANA()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new TimezoneWindowsToIANARequest
            {
                Query = "pacific standard time"
            };
            var r = await am.GetTimezoneWindowsToIANA(req);

            Assert.Null(r.Error);

            Assert.NotNull(r.Result);
        }
Пример #13
0
        public void GetCopyrightFromBoundingBox()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new CopyrightFromBoundingBoxRequest
            {
                Mincoordinates = "52.41064,4.84228",
                Maxcoordinates = "52.41072,4.84239",
                Text           = "yes"
            };
            var res = am.GetCopyrightFromBoundingBox(req).Result;

            Assert.Null(res.Error);
        }
Пример #14
0
        public void GetClosestPoint()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetClosestPoint(new AzureMapsToolkit.Spatial.GetClosestPointRequest
            {
                Lon  = -105.05860381672178,
                Lat  = 40.516153406773952,
                Udid = Guid.Parse(""),
                NumberOfClosestPoints = 2
            }).Result;

            Assert.Null(res.Error);
        }
Пример #15
0
        public void GetTimeZoneByCoordinates()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new TimeZoneRequest
            {
                Query   = "47.0,-122",
                Options = TimezoneOptions.All
            };
            var r = am.GetTimezoneByCoordinates(req).Result;

            Assert.Null(r.Error);
            Assert.Equal("US", r.Result.TimeZones[0].Countries[0].Code);
        }
Пример #16
0
        public void GetBuffer()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetBuffer(new AzureMapsToolkit.Spatial.GetBufferRequest
            {
                Udid      = System.Guid.Parse(""),
                Distances = 100.ToString()
            }).Result;

            Assert.Null(res.Error);

            Assert.NotNull(res.Result.Summary);
        }
Пример #17
0
        public void GetTimezoneWindowsToIANA()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new TimezoneWindowsToIANARequest
            {
                Query = "pacific standard time"
            };
            var r = am.GetTimezoneWindowsToIANA(req).Result;

            Assert.Null(r.Error);

            Assert.Equal(6, r.Result.Count());
        }
Пример #18
0
        public void GetTimeZoneById()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new TimeZoneRequest
            {
                Query   = "Europe/Stockholm",
                Options = TimezoneOptions.All
            };
            var r = am.GetTimezoneById(req).Result;

            Assert.Null(r.Error);
            Assert.Equal("SE", r.Result.TimeZones[0].Countries[0].Code);
        }
Пример #19
0
        public void GetMetroAreaInfo()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetMetroAreaInfo(new AzureMapsToolkit.Mobility.MetroAreaInfoRequest
            {
                Query      = "121",
                DetailType = $"{AzureMapsToolkit.Mobility.DetailType.AGENCIES}"
            }).Result;

            Assert.Null(res.Error);

            Assert.Equal("NICE bus", res.Result.Agencies.First().AgencyName);
        }
Пример #20
0
        public void GetSearchFuzzy()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new SearchFuzzyRequest
            {
                Query = "seattle"
            };
            var res = am.GetSearchFuzzy(req).Result;

            Assert.Null(res.Error);

            Assert.Equal(1, res.Result.Summary.FuzzyLevel);
        }
Пример #21
0
        public void PostClosestPoint()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.PostClosestPoint(new AzureMapsToolkit.Spatial.PostClosestPointRequest
            {
                Lon = -122.316456,
                Lat = 47.62294,
                NumberOfClosestPoints = 2
            }, "{ \"type\": \"FeatureCollection\", \"features\": [ { \"type\": \"Feature\", \"properties\": { \"geometryId\": 1001 }, \"geometry\": { \"type\": \"Point\", \"coordinates\": [ -105.02860293715861, 40.516153406773952 ] } }, { \"type\": \"Feature\", \"properties\": { \"geometryId\": 1002 }, \"geometry\": { \"type\": \"Point\", \"coordinates\": [ -105.02860381672178, 40.515990990037309 ] } }, { \"type\": \"Feature\", \"properties\": { \"geometryId\": 1003 }, \"geometry\": { \"type\": \"Point\", \"coordinates\": [ -105.02812292879467, 40.516058678088562 ] } } ] }")
                      .Result;

            Assert.Null(res.Error);
        }
Пример #22
0
        public async Task GetRouteDirectionsError()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new RouteRequestDirections
            {
                Query             = "52.50931,13.42936:52.50274,13.43872f", // intentially error
                VehicleEngineType = VehicleEngineType.Combustion,
                InstructionsType  = RouteInstructionsType.text
            };
            var directions = await am.GetRouteDirections(req);

            Assert.NotNull(directions.Error);
        }
Пример #23
0
        public void GetPointInPolygon()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetPointInPolygon(
                new AzureMapsToolkit.Spatial.PointInPolygonRequest
            {
                Lat  = 33.5362475,
                Lon  = -111.9267386,
                Udid = Guid.Parse("")
            }
                ).Result;

            Assert.Null(res.Error);
        }
Пример #24
0
        public void GetTrafficFlowSegment()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new TrafficFlowSegmentRequest
            {
                Query = "52.41072,4.84239",
                Style = TrafficFlowSegmentStyle.Absolute,
                Zoom  = 10
            };

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

            Assert.Null(r.Error);
        }
Пример #25
0
        public void GetCopyrightForTile()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new AzureMapsToolkit.Render.CopyrightForTileRequest
            {
                Zoom = 6,
                X    = 9,
                Y    = 22,
                Text = "yes"
            };
            var resp = am.GetCopyrightForTile(req).Result;

            Assert.Equal("CAN", resp.Result.Regions[0].Country.ISO3);
        }
Пример #26
0
        public void GetNearbyTransit()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetNearbyTransit(new AzureMapsToolkit.Mobility.NearbyTransitRequest
            {
                MetroId    = 121,
                Query      = "40.693393,-73.988310",
                Limit      = 5,
                Radius     = 300,
                ObjectType = AzureMapsToolkit.Mobility.ObjectType.Stop
            }).Result;

            Assert.Null(res.Error);
        }
Пример #27
0
        public async Task GetElevationDataForPolyline()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new AzureMapsToolkit.Elevation.GetElevationDataForPolylineRequest
            {
                Lines   = "-121.66853362143818, 46.84646479863713|-121.67853362143818, 46.85646479863713",
                Samples = 5
            };
            var res = await am.GetElevationDataForPolyline(req);

            Assert.Null(res.Error);

            Assert.Equal(5, res.Result.Result.Length);
        }
Пример #28
0
        public async Task GetRouteDirections()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new RouteRequestDirections
            {
                //Query = "52.50931,13.42936:52.50274,13.43872"
                Query = "62.469026,16.696987:62.397051,17.363892",
                Avoid = Avoid.tollRoads
            };
            var directions = await am.GetRouteDirections(req);

            Assert.Null(directions.Error);
            Assert.NotNull(directions.Result);
        }
Пример #29
0
        public void GetMapImage()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var req = new MapImageRequest
            {
                Format = AzureMapsToolkit.Render.RasterTileFormat.png,
                Layer  = StaticMapLayer.basic,
                Zoom   = 2,
                Center = "62,17"
            };
            var content = am.GetMapImage(req).Result;

            Assert.NotEmpty(content.Result);
        }
Пример #30
0
        public void GetTransitRoute()
        {
            var am  = new AzureMapsToolkit.AzureMapsServices(_KEY);
            var res = am.GetTransitRoute(new TransitRouteRequest
            {
                MetroId         = 121,
                Origin          = "40.680903,-73.983723",
                OriginType      = OriginType.Position,
                Destination     = "40.682051,-73.976702",
                DestinationType = DestinationType.Position
            }).Result;

            Assert.Null(res.Error);
        }