问题描述:

Sorry for the stupid question but i don't understand why the code doesn't work...

var centro= new google.maps.LatLng(0,0);

var circle = new google.maps.Circle({

strokeColor: '#FF0000',

strokeOpacity: 0.8,

strokeWeight: 2,

fillColor: '#FF0000',

fillOpacity: 0.35,

map: map,

center: centro,

radius: 1000

});

// Add the circle for this city to the map.

Can you help me?

Thanks!

网友答案:

See if this helps you...

var circleOptions = {
   strokeColor: '#FF0000',
   strokeOpacity: 0.8,
   strokeWeight: 2,
   fillColor: '#FF0000',
   fillOpacity: 0.35,
   map: map,
   center: new google.maps.LatLng(surveyors[i][5], surveyors[i][6]),
   radius: ddlRadius_value * 1609.345 // convert miles to kilometers
};

// Add the circle to the map.
var circle = new google.maps.Circle(circleOptions);

// Bind the center of the circle to the marker                    
circle.bindTo('center', marker, 'position');
网友答案:

You've centered your circle at (0,0), i.e. on the equator a bit west of Africa. Is that spot visible at all, in your map at its current position and zoom?

Also, the radius parameter is in meters. If you're zoomed out enough, your 1000-meter-radius circle will simply be too small to see.

相关阅读:
Top