i need help here. I still don't know how to check whether a point is inside a location (location given by some coordinates) or not. For example, i have an area, with given latitude and longitude like this picture
(https://i.stack.imgur.com/zR9VX.png) (the one that covered by line)
and a point (flag) inside it. What is the fastest way to check if that point is inside or outside the area??
Please help me here
We start with the formula for the area of the earth between a line of latitude and the north pole.
A = 2*pi*R*h
where R is the radius of the earth and h is the perpendicular distance from the plane containing the line of latitude to the pole. We can calculate h using trigonometry as
h = R*(1-sin(lat))
Thus the area north of a line of latitude is
A = 2*pi*R^2(1-sin(lat))
The area between two lines of latitude is the difference between the area north of one latitude and the area north of the other latitude:
A = |2*pi*R^2(1-sin(lat2)) - 2*pi*R^2(1-sin(lat1))|
= 2*pi*R^2 |sin(lat1) - sin(lat2)|
The area of a lat-long rectangle is proportional to the difference in the longitudes. The area I just calculated is the area between longitude lines differing by 360 degrees. Therefore the area we seek is
A = 2*pi*R^2 |sin(lat1)-sin(lat2)| |lon1-lon2|/360
= (pi/180)R^2 |sin(lat1)-sin(lat2)| |lon1-lon2|