Plotting a filled circle around a XY-coordinate point, with the radius corresponding to actual geographical distance

StackOverflow https://stackoverflow.com/questions/23101471

  •  04-07-2023
  •  | 
  •  

Question

I have a set of geographical coordinate points (E, N) and I want to plot them on Matlab. The coordinates of the data are measured in meters, for example a coordinate point of E = 35000, N = 756000 means a point on the map 35 km to east from the origin and 756 km north from the origin.

What I want to do is plot these coordinate points in a Matlab plot. This is easy, but what I also want to do, is to select a specific coordinate point and plot a filled circle around the point, with the radius of the circle (given as a parameter) corresponding to actual distance (in meters) in the geographical map.

The image below will explain my question (even though the circle is not filled):

enter image description here

How would this be done easily on Matlab? Any ideas? =) Please let me know if my question is unclear :)

Thank you for any help! =)

UPDATE:

here is the result I got using user natan's code:

enter image description here

perfect ;)

Was it helpful?

Solution

use fill for that, for example:

r=5000; % some radius
color=[1 0 0]; % red color
t=linspace(0,2*pi);
fill(E+r*cos(t),N+r*sin(t),color); % this creates a filled circle centered at (E,N)

note that though this creates a filled circle, when you actually plot, the axes are set automatically, so it may looks like an ellipse. In order to make it look right in any zoom, some more work needs to be done to the fill line. But that's the jist. (or use axis square)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top