views:

90

answers:

1

I'm using the following code to generate a circle on a map using the Google Maps v3 API:

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 place a text label in the centre of my circle.

I have poured over the documentation and can see no easy way to do this. The only solution I can propose to myself is to overlay a marker on top of the circle and set the icon to a transparent PNG containing the text label I want to display. However, this is a pretty inelegant solution since I cannot accurately offset the position of the icon so that it displays in the centre of the circle at any zoom level (and for the other obvious reasons).

Can anyone suggest a solution to this? I am not above manipulating the API with a third party library. I have seen some written for v2 of the API, but most of these seem to be geared toward adding a label or tooltip to a marker rather than a circle, in any case.

+1  A: 

How about you put an image overlay as it is described in the overlays section of the javascript sports documentation?

Also take a look at this

Argiropoulos Stavros