Google Maps API 以某一经纬度为中心,以某一长度位半径画圆 Draw the radius of a circle

直接看代码:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src="http://maps.google.com/maps/api/js?sensor=false&.js"></script>
<script type='text/javascript'>

    window.onload=function()
    {
        var map;
        var latlng = new google.maps.LatLng(-34.397, 150.644);
        
        function initialize() 
        {
            var mapOptions = {
                center: latlng,
                zoom: 9,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var el=document.getElementById("map_canvas");
            map = new google.maps.Map(el, mapOptions);
        
            var marker = new google.maps.Marker({
                map: map,
                position: latlng
            });
            
            var sunCircle = {
                strokeColor: "#c3fc49",
                strokeOpacity: 0.8,
                strokeWeight: 2,
                fillColor: "#c3fc49",
                fillOpacity: 0.35,
                map: map,
                center: latlng,
                radius: 15000 // in meters
            };
            cityCircle = new google.maps.Circle(sunCircle);
            cityCircle.bindTo('center', marker, 'position');
        }
        initialize();    
    }

</script>

</head>

<body>
    <div id="map_canvas" style="width:400px;height:400px;"></div>
</body>
</html>

 

参考:http://stackoverflow.com/a/12232608/4484798

 

更对参考:

Google Maps V3: 导航到指定地址 Draw (Plot) route between User’s current location and Specified location

Google Maps V3: 通过经纬度获取地址信息 Get address from Latitude and Longitude

jQuery地图插件-jqvmap

谷歌地图查询两地开车路线 Google Maps API V3: DirectionsService (Driving Directions) example

谷歌地图添加点击事件 Google Maps API V3: Add click event listener to all (multiple) markers

Google Maps API v3: Remove Markers 移除标记

点击谷歌地图后获取经纬度 Get Latitude and Longitude (Location Coordinates) using Google Maps OnClick event

GMaps.js:让你快速集成 Google Maps 服务的 jQuery 插件

Google Maps API V3: 通过邮编获取经纬度 Get Location (Latitude and Longitude) from Zip Code (Pin Code) using JavaScript

原文:Google Maps API 以某一经纬度为中心,以某一长度位半径画圆 Draw the radius of a circle

Loading

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.