Beispiel #1
0
        public Task <string> FindCountryCode(GeocodePayload payload)
        {
            string url = $"https://nominatim.openstreetmap.org/reverse?format=json&lat={payload.Lat}&lon={payload.Long}&zoom=0";

            var    res         = JObject.Parse(GetWebData(url));
            string countryCode = (string)res["address"]["country_code"];

            return(Task.FromResult(countryCode.ToUpper()));
        }
        public async Task GeocodeTest4(string Long, string Lat)
        {
            var obj = new GeocodePayload()
            {
                DevEUI = "Test",
                Time   = DateTime.UtcNow,
                Long   = Long,
                Lat    = Lat
            };

            var res = await new GeocodeService().FindCountryCode(obj);

            Assert.Equal("EC", res);
        }
Beispiel #3
0
 public Task <string> FindCountryCode(GeocodePayload payload)
 {
     return(Task.FromResult("DK"));
 }