I use the following code to create a circle on a map using the Google Maps API v3:
var postcode_a = new google.maps.Circle({ center: postcode_a_location, map: map, radius: 70, fillColor: "#3da5e1", fillOpacity: 0.5, strokeColor: "#2b546b", strokeWeight: 1 });
What I would like to do is put a text label in the center of the circle .
I have posted the documentation and do not see an easy way to do this. The only solution I can offer myself is to put a marker on the top of the circle and set the icon to a transparent PNG containing the text label I want to display. However, this is a rather inelegant solution, since I canβt precisely compensate for the position of the icon so that it appears in the center of the circle at any zoom level (and for other obvious reasons).
Can anyone suggest a solution? I am not over manipulating the API using a third-party library. I saw some written for the v2 API, but most of them seem to be aimed at adding a label or tooltip to the marker, and not to the circle, anyway.
source share