I would like to save a circle in a sql-server 2008 geography field, using c#.
In c# I have a latitude, a longitude and a radius but I just can\'t find a way to calculate
OK, found the answer on my own. The trick is to create a point
var point = SqlGeography.Point(latitude, longitude, 4326);
Then create a buffer around the point
var poly = point.BufferWithTolerance(radiusInMeter, 0.01, true); //0.01 is to simplify the polygon to keep only a few sides
Then you could simply create a SqlCommand
and add the polygon as parameter:
var param = new SqlParameter(@"Polygon", poly);
param.UdtTypeName = "Geography";
command.Parameters.Add(param);
Hope that will help someone else in the future!