I have very limited experience with GIS systems.
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
I want to pass the box coordinates to my backend system, which will return me information on any 'places' within the box.
What is the math to determine if a 'place' actually falls within the bounds of the box?