Reputation: 37068
I'm trying to draw a circle with radius X kilometers, but it occurred to me that the radius option isn't being measured in km, since the api example has a radius of 400,000 but only actually goes out about 500 miles.
does anyone know what unit it's using?
Upvotes: 44
Views: 31801
Reputation: 6329
As the previous answer has indicated, meters is the default unit. So if you're after km, just multiply by 1000 for meters on the radius property.
// Add radius overlay to map
const set_radius = new google.maps.Circle({
strokeColor: "#f38038",
strokeOpacity: 0.4,
strokeWeight: 2,
fillColor: "#f38038",
fillOpacity: 0.25,
map: your_map_variable,
center: new google.maps.LatLng(lat, lng),
radius: 20 * 1000, // 20km
});
Upvotes: 1