Link to home
Create AccountLog in
Avatar of ramrocket
ramrocket

asked on

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.  


thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of ramrocket
ramrocket

ASKER

Can you please provide me with a formula to do this.
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???
UL_LON
UR_LON
LR_LON
LL_LON
and
UL_LAT
UR_LAT
LR_LAT
LL_LAT
ah got it.