Esempio n. 1
0
        public String solicitarClima(String lugar)
        {
            LocationIQ          loc   = new LocationIQ();
            Coordenada          coor  = loc.solicitarCoordenadas(lugar);
            GetClimaOpenWeather clima = levantarJSON(coor);

            return(clima.temp);
        }
Esempio n. 2
0
        public GetClimaOpenWeather levantarJSON(Coordenada coor)
        {
            String l = "api.openweathermap.org/data/2.5/weather?lat=" + coor.lat + "&lon=" + coor.lon;
            //var json = new WebClient().DownloadString(l);
            var json = System.IO.File.ReadAllText(@"../../datosClimaOpenWeather.json");
            GetClimaOpenWeather clima = JsonConvert.DeserializeObject <JObject>(json).Value <JObject>("main").ToObject <GetClimaOpenWeather>();

            return(clima);
        }