Validate geographical coordinates

Asked

Viewed 1,360 times

0

How can I validate a geographic coordinate to know if it actually corresponds to a valid location? For example, -47.888477, -100.555444; These coordinates I didn’t pick up on any map, they’re random numbers that came to me now to use example, how do I know if it’s a valid coordinate?

  • What you consider a valid coordinate?

  • For example, -47.888477, -220.555444 seems to me to be invalid because from what I saw searching the google-map, there is no longitude that reaches -220. I need to know exactly what valid coordinates are so I can create an algorithm to validate. I can validate the amount of characters typed but to validate whether the numbers passed correspond to a valid coordinate, I need to know exactly that, what the characteristics of a valid coordinate, I need to know things like, latitude can go from -X to X positive, longitude of -X to X positive etc..

  • Matheus, in a normal situation in everyday life, what would be the need for this validation? Taking into account that it is not feasible to ask a user to enter their coordinates in a text area.

  • It won’t be! The coordinates will come from devices running apps integrated with the google map api, but I want to have some validation in my application, even though the chances of apps sending an invalid coordinate are very small. The mobile app will take the location coordinate and send via web service.

1 answer

2


Google uses the standard coordinate system WGS84. To validate you can consider these approximate values:

Latitude: max/min +90 to -90

Longitude: max/min +180 to -180

  • This will depend on the coordinate systems you are using (UTM, Degrees, minutes and seconds,...)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.