function getPointByInputAndUpdate(address, city) {
var myGeo = new BMap.Geocoder();
myGeo.getPoint(address, function(point) {
if (point) {
console.log(point);
var lat = point.lat;
var lng = point.lng;
var url = ‘https://api.caiyunapp.com/v2/YDtzWkC7ocVkAMUW/’ + lng + ‘,’ + lat +
‘/forecast.json’;
doAjaxUpdate(url);
var point = new BMap.Point(lng, lat);
var geoc = new BMap.Geocoder();
geoc.getLocation(point, function(rs) {
var addComp = rs.addressComponents;
// alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " +
// addComp.streetNumber);
var province = addComp.province;
var city = addComp.city;
var district = addComp.district;
var street = addComp.street;
$(’#cityAddress’).text(province + city + district + street);
});
} else {
alert(“您选择地址没有解析到结果!”);
}
}, city);
}
//运用百度地图进行操作
彩云天气天气预报简单系统1
最新推荐文章于 2022-06-05 16:29:18 发布