Skip to content
Snippets Groups Projects
Commit 8413ef7a authored by Raoul de Villiers's avatar Raoul de Villiers
Browse files

Added explanation regarding unknown coordinates to readme.

parent f1bdbd8c
No related branches found
No related tags found
No related merge requests found
......@@ -482,6 +482,30 @@ However, there can be only one set of latitude/longitude attributes, and whichev
The reason for this is that we don't want ambiguity when doing distance calculations. We need a single, authoritative source for coordinates!
It is then possible to call both forward and reverse geocoding sequentially.
For example:
class Venue
after_validation :geocode, :reverse_geocode
end
For certain geolocation services such as Google geolocation API this may cause issues during subsequent updates to database records if the longtitude and latitude attributes are not on a known feature, because the following call:
after_validation :geocode
will change the longtitude and latitude based on the location field, which would be the closest known location to the original coordinates. In this case it is better to add conditions to each call, as not to override coordinates that do not have features associated with them.
For example:
class Venue
after_validation :reverse_geocode, :if => :has_coordinates
after_validation :geocode, :if => :has_location, :unless => :has_coordinates
end
Use Outside of Rails
--------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment