高德地图地理编码
导入高德地图css和js文件地址
<link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/>
<script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=你的key&plugin=AMap.Geocoder"></script>
<script src="https://cache.amap.com/lbs/static/es5.min.js"></script>
js代码
创建id为largeMapContent的div盒子
var map = new AMap.Map("largeMapContent", {
resizeEnable: true,
center: [120.552868,31.307496]//设置地图中心点坐标
});
var geocoder = new AMap.Geocoder({
// city: "010", //城市设为北京,默认:“全国”
});
var marker = new AMap.Marker();
function geoCode() {
//开发中address从后台获取值
var address = "塔园路233号津西新天地2号楼";
geocoder.getLocation(address, function(status, result) {
if (status