Traditional Culture Encyclopedia - Weather inquiry - How to get the weather forecast of Cai Yun?
How to get the weather forecast of Cai Yun?
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
- Related articles
- Notice on the implementation opinions of physical education and health examination for junior high school graduates in Quanzhou City, Fujian Province in 2022
- Super A Wear and Share: Hot Girl Style Jacket with Cheats!
- What clothes should I bring to Tibet in June? Be specific. .
- [Those 37 letters] 28 1 letter
- Dig bamboo shoots and send friends to write short sentences.
- What do you mean by hot and cold?
- Drinking soup in hot weather is the most nourishing, 8 kinds of soup, refreshing and appetizing, not greasy, cook a pot every three to five times!
- How to check the highway closure?
- How to choose a microwave oven
- Crude oil futures hit a three-month high of/kloc-0. Why did this value suddenly rise?