By entrigan on
I need to geocode an address and save it in a cck field (or elsewhere in the db). I have checked out location and geo modules, but I am really looking for a simpler solution to simply save lat and lon data and nothing else. Any ideas?
My intuition was to use Google's geocoding service, but afaik that requires javascript which I think would be difficult to run on node edit submits.
Comments
In the end you need to do
In the end you need to do what the location module already does. Since it provides a more structured approach to collecting an address there is a better chance it will be encoded correctly. The bottom line I would just use the location module.
that makes sense, but I am
that makes sense, but I am very tentative, partially because of this article and also because ultimately I may be looking to do some caching and more advanced features which will be made more difficult by the location module.
So Google's geocoder can
So Google's geocoder can handler either js or a http request. Using the latter, and combined with computed field, I am able to store latitude with the following code in computed field:
This could also be done with hook_nodeapi but I think possibly computed field avoids doing a second node_save (not sure about that).