Create circle around coordinates
See original GitHub issueIs there any possibility to get a circle around a point with the actual diameter? I have the latitude, longitude and the diameter of a Mesocyclone object. Currently I use a default value for the radius while drawing a circle using a Polygon. Is there any possibility, to draw the circle around that point with the actual size (e.g. 10km)? My current code:
private static Layer CreateMesoDiameterLayer(List<Mesocyclone> mesocyclones)
{
var features = new Features();
return new Layer("Diameter Layer")
{
DataSource = new MemoryProvider(CreateDiameterCircles(mesocyclones)),
Style = new VectorStyle
{
Fill = new Brush(new Color(255, 97, 247, 50)),
Outline = new Pen
{
Color = new Color(121, 97, 255, 200),
Width = 2,
PenStyle = PenStyle.LongDashDot,
PenStrokeCap = PenStrokeCap.Butt
}
}
};
}
private static List<Polygon> CreateDiameterCircles(List<Mesocyclone> mesocyclones)
{
var result = new List<Polygon>();
foreach (var meso in mesocyclones)
{
var polygon = new Polygon();
var middle = FromLongLat(meso.Longitude, meso.Latitude);
double radius = 100000; // Currently default value. Here I want to have the actual diameter (property of a mesocyclone
for (double angle = 0; angle <= 2 * Math.PI; angle += 0.2)
{
polygon.ExteriorRing.Vertices.Add(
new Point(
middle.X + radius * Math.Cos(angle),
middle.Y + radius * Math.Sin(angle)));
}
result.Add(polygon);
}
return result;
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Draw a circle with a radius on a map
Use this tool to draw a circle by entering its radius along with an address. You can also click a point on the...
Read more >Create circles—ArcGIS Pro | Documentation
Create circles from known coordinates · In the Distance and Direction pane, click the Circle tab. · Enter a coordinate in the Center...
Read more >Radius Around a Point on a Map
First type in the radius required in kilometers or miles and then click on the map at the center of where you wish...
Read more >Producing Points in a Circle with Specific Radius from ...
I need to be able to take a set of lat/lon coordinates and draw a circular "fence" around those coordinates on a map,...
Read more >Generate a circle of coordinates around a point, but I'm ...
I'm using the following code to attempt to generate a circle of coordinates a fixed distance (in this case 1km) around a point....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I dont’t know, if theres a better way, but I managed to do the job with a little bit of maths. Maybe, it will help someone in the future, so I share my solution with you.
Basically I created a function, that creates a new Point from a given
longitude,latitude,distanceandbearing/rotation:When I create the layer for the diameter rings, I just call that function in a for loop (<= 360 degrees) and add the generated point to the polygon:
I assume, that you don’t use Xamarin.Forms. That’s the reason why you don’t have this class. But you could look, how the Xamarin.Forms implementation does it.