- #1
MartinV
- 69
- 0
I'm doing this in Matlab but it's not restricted to any particular software.
I have a bunch of geographical points (x,y coordinates for each) and I want to take all the points that are 50 km or closer to the reference point. I took the great-circle equation to convert geographical longitude and latitude into angular distance which I can then multiply with Earth's radius and I'm done.
The thing is when I plot all the points that are supposed to be 50 km away or closer to my center (and make sure both axis have the same scale by typing "axis equal"), the points make out an ellipse, not a circle. I rechecked the code and everything seems fine. I made double sure by drawing a circle on top of my plot and yes, some points stick out on the sides.
Do you guys have any idea what could cause this? I was thinking of maybe the data being distorted due to Earth's curvature but the data was collected from the Earth's surface, not from a satellite.
Here's my code that takes the events and sorts them according to their range:
function B = handBag(ref,A,R) %A is the main dataset, R radius, ref reference point
B = [];
for i = 1:length(A)
if (ang(ref,A(i, <= R/6371)
B = [B; A(i,:)];
end
end
end
function y = ang(A,B) %calculates the angle difference between two points
yy = sin(A(2)*pi/180) *sin(B(2)*pi/180) + cos(A(2)*pi/180) *cos(B(2)*pi/180) ...
*cos(-1*(A(1)-B(1))*pi/180);
y = acos(yy);
end
I have a bunch of geographical points (x,y coordinates for each) and I want to take all the points that are 50 km or closer to the reference point. I took the great-circle equation to convert geographical longitude and latitude into angular distance which I can then multiply with Earth's radius and I'm done.
The thing is when I plot all the points that are supposed to be 50 km away or closer to my center (and make sure both axis have the same scale by typing "axis equal"), the points make out an ellipse, not a circle. I rechecked the code and everything seems fine. I made double sure by drawing a circle on top of my plot and yes, some points stick out on the sides.
Do you guys have any idea what could cause this? I was thinking of maybe the data being distorted due to Earth's curvature but the data was collected from the Earth's surface, not from a satellite.
Here's my code that takes the events and sorts them according to their range:
function B = handBag(ref,A,R) %A is the main dataset, R radius, ref reference point
B = [];
for i = 1:length(A)
if (ang(ref,A(i, <= R/6371)
B = [B; A(i,:)];
end
end
end
function y = ang(A,B) %calculates the angle difference between two points
yy = sin(A(2)*pi/180) *sin(B(2)*pi/180) + cos(A(2)*pi/180) *cos(B(2)*pi/180) ...
*cos(-1*(A(1)-B(1))*pi/180);
y = acos(yy);
end