I have a Ruby on Rails Camping model with the attributes #latitude and #longitude .
This must be confirmed. It must be checked so that:
- Values ββare formatted correctly. For instance. 48.8582 and 2.2945, as well as 48.8 and 2.2. Any accuracy should be allowed. I store them as a float, is any additional verification necessary or recommended?
- They are in acceptable ranges (0-90). Or should I allow negative numbers or numbers above and below 90?
I am not interested in whether this item is a valid valid address (sea, north pole, whatever, if it is a valid point on earth).
I am using a geocoder gem, but at the moment the input is just a pair of lat / lon text fields. The geocoder is just interested in this question because it can have useful methods (which I cannot find) for checking the lat / long pair.
source share