Search code examples
geolocationgpscoordinatesmkmapviewmkannotation

How to validate latitude and longitude


I have two UITextFields which users can enter in a latitude and longitude, these co-ordinates are then used to create a pin on an MKMapView.

I want find a way to validate whether the values they enter are actual GPS co-ordinates or just a load of rubbish. Is there any way of doing this?


Solution

  • The latitude must be a number between -90 and 90 and the longitude between -180 and 180.