高德api整理地图覆盖物

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <style>
    html,
    body,
    #container {
      width: 100%;
      height: 100%;
    }
  </style>
  <title>圆的绘制</title>
  <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
  <script src="https://webapi.amap.com/maps?v=1.4.12&key=7b6ccda63f7884f88bbd464a00517b68&plugin=AMap.CircleEditor"></script>
  <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.12&key=7b6ccda63f7884f88bbd464a00517b68&plugin=AMap.Geocoder"></script>
  <script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
    var geocoder;
    if(!geocoder){
        geocoder = new AMap.Geocoder({
            // city: "010", //城市设为北京,默认:“全国”
        });
    } 
    $(function () {
        var address="北京市朝阳区阜荣街10号";
        geocoder.getLocation(address, function(status, result) {
            var lat = result.geocodes[0].location.lat
            var lng = result.geocodes[0].location.lng
            var map = new AMap.Map("container", {
                center: [lng.toString(),lat.toString()],
                zoom: 14,
            })
            var circle = new AMap.Circle({
                center: [lng.toString(),lat.toString()],
                radius: 2000, //半径
                borderWeight: 3,
                strokeColor: "#FF33FF",
                strokeOpacity: 1,
                strokeWeight: 6,
                strokeOpacity: 0.2,
                fillOpacity: 0.4,
                strokeStyle: 'dashed',
                strokeDasharray: [10, 10],
                // 线样式还支持 'dashed'
                fillColor: '#1791fc',
                zIndex: 50,
            })
            circle.setMap(map)
            // 缩放地图到合适的视野级别
            map.setFitView([ circle ])
        });
    })

</script>
</body>
</html>

 

 

本文为转载侵权删

转载于:https://my.oschina.net/u/3774949/blog/2999025

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值