Traditional Culture Encyclopedia - Weather inquiry - How to get the weather forecast of Cai Yun?

How to get the weather forecast of Cai Yun?

Tencent location service platform provides an interface for obtaining latitude and longitude.

Cai Yun weather application developer api calls the corresponding latitude and longitude weather conditions.

The test environment chose jsbox on its iphone to run a simple JS script:

//The simple idea is to get the ip and then get the weather information.

const location key = " xxxxxxxxxxxxxx "

const weatherKey = "XXXXXXXXXXXX "

const apiList = {

Location: "/ws"

}

Function getLonLat(){

$ mend);

}

});

}

/**

*

* @param {lat: "",lng:""} location

*/

Function getWeather(location){

$/% E9 % 80% 9A % E7 % 94% A8 % E9 % A2 % 84% E6 % 8A % A5 % E6 % 8E % A5 % E5 % 8F % A3/v 2.5

}

});

}

getLonLat()

2|0 suddenly woke up.

In fact, I just want to test the basic usage and usability of the two interfaces, and then it suddenly occurred to me that the built-in $location of jsbox can directly obtain the location information of the equipment, so that the location coordinates obtained will be more accurate than ip.

//Get the location of the mobile phone according to the native SDK.

Function getPhoneLoc(){

$location.fetch({

Handler: Function (Response) {

var lat = resp.lat

var lng = resp.lng

var alt = resp.alt

let loc = {lat:lat,lng:lng}

Get location (location)

}

});

}

3|0 Last Run Result