Validate a geographic location
Checks if latitude and longitude are within valid ranges and returns detailed error messages if invalid.
Note: This does NOT normalize the values - it checks them as-is. Use normalizeLatitude/normalizeLongitude first if needed.
normalizeLatitude
normalizeLongitude
Geographic location to validate
Validation result with error messages
validateLocation({ latitude: 51.5, longitude: -0.1 })// { valid: true, errors: [] }validateLocation({ latitude: 95, longitude: -0.1 })// { valid: false, errors: ['Latitude must be between -90 and +90, got 95'] } Copy
validateLocation({ latitude: 51.5, longitude: -0.1 })// { valid: true, errors: [] }validateLocation({ latitude: 95, longitude: -0.1 })// { valid: false, errors: ['Latitude must be between -90 and +90, got 95'] }
Validate a geographic location
Checks if latitude and longitude are within valid ranges and returns detailed error messages if invalid.
Note: This does NOT normalize the values - it checks them as-is. Use
normalizeLatitude/normalizeLongitudefirst if needed.