高德地图系列文章之多边形polygon



<!DOCTYPE html>

<html>
<head>
<title>map</title>
<script type="text/javascript" src=""></script>
<style type="text/css">
body,html,#container{
        height: 100%;
        margin: 0px;
    }
</style>
</head>
<body>
<div id="container" tabindex="0"></div>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.0&key=86a4b7cc36b60dcaa93e5ab86f4d4007"></script>
    <script type="text/javascript">
        var map = new AMap.Map('container',{
            resizeEnable: true,
            zoom: 18,
            center: [116.40249623233241,39.92292807688322]
        });
// path:[
//                 new AMap.LngLat(116.4137441460175,39.90125217483801),
//                 new AMap.LngLat(116.41463346014412,39.901278423806424),
//                 new AMap.LngLat(116.4146334601453,39.90129242381057),
//                 new AMap.LngLat(116.41374014460584,39.901266173722455)
//             ],


        var option = {
        map:map,
        path:[
                [116.40249623233241,39.92292807688322],
                [116.4025172394779,39.9229280825497],
                [116.40250723606474,39.92309507987206],
                [116.40248522857951,39.92309307393583]
            ],
        strokeColor: "#238CFB", //线颜色
            strokeOpacity: 1, //线透明度
            strokeWeight: 2,    //线宽
            strokeStyle: "solid",
            fillColor: "#2B90FB", //填充色
            fillOpacity: 0.2//填充透明度
        }
        var polygon = new AMap.Polygon(option);
        polygon.setMap(map);
    </script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/gytha_1/article/details/80695867