Assuming that the coordinates you want to check are station.latitude
and station.longitude
, and the four sides are named as you indicated in your code, then the condition becomes
if(station.latitude < lowerrightlatitude && station.latitude > upperleftlatitude && station.longitude < upperleftlongitude && station.longitude > lowerrightlongitude)
This is assuming that the names of your variables are sensible indications of where they are in the rectangle. You might want to convince yourself that this still works when the sign changes (use -ve values for West longitude, and South latitude, and you should be OK).