just to elaborate on that, V3 returns something like that if you try to 
geocode "Rome"

....
  <geometry>
   <location>
    <lat>41.8905198</lat>
    <lng>12.4942486</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>41.6558738</lat>
     <lng>12.2344266</lng>
    </southwest>
.....

function returns the tuple (latitude, longitude), so this patch fix the 
previous incorrect behaviour, with the nice addition of using the V3 
version of geocode provided by google (previous one used the deprecated V2)

@Omi, if that's okay, I'll open an issue on googlecode to let Massimo 
include this patch in web2py.

Il giorno venerdì 15 giugno 2012 21:57:46 UTC+2, Omi Chiba ha scritto:
>
> The patch also works for me !
>
> I'm a little bit confused about if the online book is correct or incorrect 
> discussion. After that patch, it's also working if we use "Correct" syntax 
> and not the "Incorrect" one which is on online book. So everyone who use 
> this first time will make the same mistake as mine because it's opposite. 
>
> *Correct*
> (longitude, latitude) = geocode(address)
>
> *Incorrect*
> (latitude, longitude) = geocode(address)
>
>
> On Friday, June 15, 2012 2:51:23 PM UTC-5, Paolo Caruccio wrote:
>>
>> I see the correct url in first message, so post editing worked. The patch 
>> is good for me.
>>
>> Niphlod, thank you
>>
>>
>> Il giorno venerdì 15 giugno 2012 21:45:14 UTC+2, Niphlod ha scritto:
>>>
>>> tried to edit the post but seems that edits are not working..... 
>>> the url is wrong, 
>>>
>>> http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=%s 
>>>
>>> has to be replaced with
>>>
>>> http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=%s
>>>
>>> Sorry for that.
>>>
>>>

Reply via email to