根据地理位置获取经纬度

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
</head>

<body>
<script src="https://webapi.amap.com/maps?v=1.4.6&key=e163cbe37323c268a52d856b3acbfef"></script>
<script type="text/javascript">


AMap.plugin('AMap.Geocoder', function() {
var geocoder = new AMap.Geocoder({
// city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode

})

geocoder.getLocation('山东省淄博市', function(status, result) {
console.log(result)
if (status === 'complete' && result.info === 'OK') {
// result中对应详细地理坐标信息

}
})
})

 


</script>
</body>

</html>

posted @ 2018-08-16 16:40  刘浩2561179983  阅读(1121)  评论(0编辑  收藏  举报