I know I should be able to do this, but I'm old and I've forgotten.
The issue is that SQL Server 2008 doesn't support a circle in its geospatial data type (as far as I can tell - still waiting on my Dev Ed).
So, I need to create an n-sided polygon that covers the same area as a circle of the same radius.
I'm using Google Maps to show this to TPTB within the company (I'm on a learning exercise, so having a LOT of fun).
Currently, I have the following code:
fn_makePolygon = function(map, polygon, i_Points, i_Radius)
// Using the geometry library, calculate an array of points for the polygon
var a_Path = ;
var ll_Centre = map.getCenter();
var f_Angle = 360 / i_Points;
var f_Distance = i_Radius * 1609.344; // Meters to miles conversion.
for(var i_Point = 0 ; i_Point <= i_Points ; ++i_Point)
i_Point * f_Angle
This creates an n-sided closed polygon whose points lie on a circle of the same radius - you can see this in action at n-sided polygon fits inside circle
What I would like is actually 2 fold.
1 - To calculate the path of an n-sided polygon so that the circle fits inside the polygon (just like the existing polygon fits inside the circle)
2 - To calculate the path of an n-sided polygon so that the area of the circle and the polygon are the same.
Don't worry about the coding, if you have issues with that, just the maths required will be enough for me.
I'm guessing that all I really need is to adjust the meters/miles conversion as this is all that actually alters the side the polygon.
P.S. I'm using Google Chrome V10, so the sliders are not going to be visible in older browsers - simply enter the number and tab off the input seems to work OK for IE/FF. This is just a test script, so not an important issue.