Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Not 100% sure if this is the correct place to ask my question so I apologise if it isn't. Also, I have very limited experience with GIS systems, so please pardon my ignorance if some of my terminology is wrong, or if my question is actually very trivial.

I am writing an iOS application which will show a number of places on a map. At my back end, I store the 'places' in the format:

Placename - string
Lat - decimal
Lon - decimal

I determine the current viewable area of the map (on the device) using the following Objective-C code:

MKMapRect mRect = self.mapView.visibleMapRect;
MKMapPoint neMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect), mRect.origin.y);
MKMapPoint swMapPoint = MKMapPointMake(mRect.origin.x, MKMapRectGetMaxY(mRect));
MKMapPoint nwMapPoint = MKMapPointMake(swMapPoint.x, neMapPoint.y);
MKMapPoint seMapPoint = MKMapPointMake(neMapPoint.x, swMapPoint.y);
CLLocationCoordinate2D neCoord = MKCoordinateForMapPoint(neMapPoint);
CLLocationCoordinate2D swCoord = MKCoordinateForMapPoint(swMapPoint);
CLLocationCoordinate2D nwCoord = MKCoordinateForMapPoint(nwMapPoint);
CLLocationCoordinate2D seCoord = MKCoordinateForMapPoint(seMapPoint);
NSLog(@"NW: %f, %f", nwCoord.latitude,nwCoord.longitude);
NSLog(@"NE: %f, %f", neCoord.latitude,neCoord.longitude);
NSLog(@"SE: %f, %f", seCoord.latitude,seCoord.longitude);
NSLog(@"SW: %f, %f", swCoord.latitude,swCoord.longitude);

This will give me an output of:

NW: 54.558793, -1.268541
NE: 54.558793, -1.254808
SW: 54.549659, -1.268541
SE: 54.549659, -1.254808

Its actually a box around my local bar :)

I want to pass the box coordinates to my backend system, which will return me information on any 'places' within the box.

What I require help with is the math to determine if a 'place' actually falls within the bounds of the box.

If anyone could give me an example of the math required, I would be very grateful.

Kind Regards

share|improve this question
Do you need something more complicated than min_lon_BB <= place_lon <= max_lon_BB and min_lat_BB <= place_lat <= max_lat_BB, where BB stands for Bounding Box? – SS_Rebelious May 4 '13 at 15:34
up vote 2 down vote accepted

As is typical after asking my question, I think I found a solution.

Based on the NW and SW point, the following pseudo code, will return me items within the bounding box.

Lat <= NW.LAT 
Lat >= SW.LAT
Long <= NE.LON 
Long >= SW.LON
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.