uniapp reverses geogeology according to latitude and longitude

uni.request({

    header:{

		"Content-Type": "application/text"

	},

	//注意:这里的key值需要高德地图的 web服务生成的key  只有web服务才有逆地理编码

	url:'https://restapi.amap.com/v3/geocode/regeo?output=JSON&location='+经度+','+纬度+'&key=你的key值&radius=1000&extensions=all',

	success(re) {

		if(re.statusCode===200){

			that.citydata=re.data.regeocode.addressComponent;

			console.log("国家:"+that.citydata.country);

			console.log("省:"+that.citydata.province);

			console.log("市:"+that.citydata.city);

			console.log("县:"+that.citydata.district);

							
		}else{

							
		}

	}

});

Guess you like

Origin blog.csdn.net/fbqgdxw/article/details/122337486