# Latitude, Longitude, Center Point

Hi, I need to find out how to know if a given point expressed in actual latitude and longitude is inside a box.  The box is also expressed in actual latitude and longitude:

UL_LON = upper let lon
UL_LAT = upper left lat, etc

(UL_LON, UL_LAT)               (UR_LON, UR_LAT)
+---------------------------------------------+
|                                                         |
|                                                         |
|                             +                          |
|                 (PT_LON,PT_LAT)              |
|                                                         |
|                                                         |
+---------------------------------------------+
(LL_LON, LL_LAT)               (LR_LON, LR_LAT)

How do I find out if (PT_LON, PT_LAT) is inside the square.

###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
If the sides of the square can be sufficiently approximated by loxodromes, you can use any point in polygon algorithm.
If they follow great circles, it can get a little more interesting near the edges.
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Can you please provide me with a formula to do this.
0
Author Commented:
ozo,

in the funtion:

int pnpoly(int npol, float *xp, float *yp, float x, float y)

what are the values in these arrays xp and yp???
0
Commented:
UL_LON
UR_LON
LR_LON
LL_LON
and
UL_LAT
UR_LAT
LR_LAT
LL_LAT
0
Author Commented:
ah got it.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Math / Science

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.