How to draw a circle of a certain radius (in meters) around the current position in the Google Maps API? The position of the circle, respectively, must be updated with each update of the user's position.

  • one
    Do you need this? - eugeneek

1 answer 1

Use objects of type Circle - Google Maps API documentation . Make the necessary changes to the circle options you need:

var LatLng = new google.maps.LatLng(p.coords.latitude,p.coords.longitude); var mapOptions = { center: LatLng, zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map"), mapOptions); var cityCircle = new google.maps.Circle({ strokeColor: '#FF0000', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#FF0000', fillOpacity: 0.35, map: map, center: LatLng, radius: 100 }); }); 

A source