User-1446685904 posted
You need to store the latitude and longitude that you get from the polygon. I had created such application to store the latitude and longitude and i need to produce a circle based on those values. The below given function expalins this:
function DrawCircle(point, center) {
polySmallRadius = document.getElementById('ctl00_body_txtRadius').value;
if (polySmallRadius == '' || polySmallRadius == null) {
alert('Please enter Radius');
return false;
}
if (center == 1)
map.setCenter(new GLatLng(point.y, point.x), polySmallRadius);
var polyPoints = Array();
var mapNormalProj = G_NORMAL_MAP.getProjection();
var mapZoom = map.getZoom();
var clickedPixel = mapNormalProj.fromLatLngToPixel(point, mapZoom);
var polyNumSides = 10;
var polySideLength = 360 / polyNumSides;
polyNumSides = 20;
polySideLength = 18;
for (var a = 0; a < (polyNumSides + 1); a++) {
var aRad = polySideLength * a * (Math.PI / 180);
var polyRadius = polySmallRadius;
var pixelX = clickedPixel.x + polyRadius * Math.cos(aRad);
var pixelY = clickedPixel.y + polyRadius * Math.sin(aRad);
var polyPixel = new GPoint(pixelX, pixelY);
var polyPoint = mapNormalProj.fromPixelToLatLng(polyPixel, mapZoom);
polyPoints.push(polyPoint);
}
var polygon = new GPolygon(polyPoints, "#000000", 2, .5, "#00ff00", .5);
map.addOverlay(polygon);
}