You basically just need to define an object with an SVG circular path and assign it to a marker's icon
property. Here's a chunk of code from where I've done something like this. Note that you will need to play with the path
definition and/or the scale
property to get the results you want, but this demonstrates the overall recipe:
// Somewhere in your code you define an object you'll use as an icon.
// You only need to instantiate this once.
var circleIcon = {
path: 'M 0, 0 m -10, 0 a 10, 10 0 1, 0 20, 0 a 10, 10 0 1, 0 -20, 0',
fillColor: '#00FFFF',
fillOpacity: 0.0,
scale: 1,
strokeColor: '#00FFFF',
strokeWeight: 2,
strokeOpacity: 0.8
};
// Then elsewhere in your code you can create markers like this.
// Many markers can reference the same icon object.
var latLng = new google.maps.LatLng(33.9958, -80.8896);
var circleMarker = new google.maps.Marker({
icon: circleIcon
position: latLng,
map: map
});
// Optionally, you can use methods like these set marker properties.
//circleMarker.setPosition(latLng );
//circleMarker.setVisible(true);
//circleMarker.setMap(map);
On another note, with respect to preserving "a slight bit of privacy", it sounds like the center of your circle still represents the user's true position. So you might want to consider introducing some subtle, random offsets to the LatLng
coordinates coming out of your geocoder. Based on a quick review of decimal degrees, fluctuations of +/- 0.001 to 0.009 in both the Latitude and Longitude values should give you some slosh of about 100 to 1000 meters, which might be sufficient for your purposes. If I were doing this, I'd probably look at some sample points and compare their true position to their "randomly offset" position before I went live with it though, mostly just to give it a reality check.