Paolo,
I can retrieve latitude and longitude no problem. I just can't pass the
value in the javascript.
So this shows correct value
<p>longtitude,latitude: {{=longitude}},{{=latitude}}</p>
but cannot pass in here using {{=}}
<script>
$(document).ready(function(){
map = new GMaps({
div: '#map',
lat: {{=latitude}},
lng: {{=longitude}}
});
});
</script>
On Friday, June 15, 2012 12:28:31 PM UTC-5, Paolo Caruccio wrote:
>
> It seems geocode function returns inverted coordinates.
>
> Please try: (longitude, latitude) = geocode(address)
>
> Il giorno venerdì 15 giugno 2012 17:47:33 UTC+2, Omi Chiba ha scritto:
>>
>> Now, I want to pass the latitude and longitude variable to the java
>> script. How can I do this ? Obviously, the following method doesn't work.
>>
>> *default/index.html*
>>
>> {{extend 'layout.html'}}
>> <script src="http://maps.google.com/maps/api/js?sensor=true"></script>
>> <script src="{{=URL('static','js/gmaps.js')}}"></script>
>>
>>
>> <div>
>> {{=form.custom.begin}}
>> {{=form.custom.widget.search}}{{=form.custom.submit}}
>> {{=form.custom.end}}
>> </div>
>> {{if longitude or latitude:}}
>> <p>longtitude,latitude: {{=longitude}},{{=latitude}}</p>
>> <div id="map" style="height:400px;width:800px"></div>
>>
>>
>> <script>
>> $(document).ready(function(){
>> map = new GMaps({
>> div: '#map',
>> lat: {{=latitude}},
>> lng: {{=longitude}}
>> });
>> });
>> </script>
>> {{pass}}
>>
>> *controllers/defalut.py*
>> def index():
>> from gluon.tools import geocode
>> latitude = ''
>> longitude = ''
>> form=SQLFORM.factory(Field('search'), _class='form-search')
>> form.custom.widget.search['_class'] = 'input-long search-query'
>> form.custom.submit['_value'] = 'Search'
>> form.custom.submit['_class'] = 'btn'
>> if form.accepts(request):
>> address=form.vars.search
>> (latitude, longitude) = geocode(address)
>> else:
>> (latitude, longitude) = ('','')
>> return dict(form=form, latitude=latitude, longitude=longitude)
>>
>>
>>
>>
>>
>> On Friday, June 15, 2012 10:42:04 AM UTC-5, Omi Chiba wrote:
>>>
>>> It worked !!
>>>
>>>
>>> On Friday, June 15, 2012 10:18:20 AM UTC-5, Paolo Caruccio wrote:
>>>>
>>>> try to move
>>>> <script src="http://maps.google.com/maps/api/js?sensor=true"></script>
>>>> <script src="{{=URL('static','js/gmaps.js')}}"></script>
>>>>
>>>> below
>>>>
>>>> {{extend 'layout.html'}}
>>>>
>>>>
>>>> Il giorno venerdì 15 giugno 2012 16:59:43 UTC+2, Omi Chiba ha scritto:
>>>>>
>>>>> Can anyone point out what I'm doing wrong ?
>>>>>
>>>>> I downloaded gmaps.js and placed under static/js, then tried the
>>>>> following code but nothing shows..
>>>>>
>>>>> default/index.html
>>>>> <script src="http://maps.google.com/maps/api/js?sensor=true"></script>
>>>>> <script src="{{=URL('static','js/gmaps.js')}}"></script>
>>>>> {{extend 'layout.html'}}
>>>>>
>>>>>
>>>>> <script>
>>>>> $(document).ready(function(){
>>>>> map = new GMaps({
>>>>> div: '#map',
>>>>> lat: -12.043333,
>>>>> lng: -77.028333
>>>>> });
>>>>> });
>>>>> </script>
>>>>>
>>>>>
>>>>> <div id="map" style="height:200px;width:200px;"></div>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sunday, June 10, 2012 8:17:48 AM UTC-5, mcm wrote:
>>>>>>
>>>>>> Javier,
>>>>>>
>>>>>> No thanks no help needed by me at the moment. :-D
>>>>>> Simply bad writing, sorry. It should have been:
>>>>>>
>>>>>> "[This] Helps implementing google maps."
>>>>>>
>>>>>> http://hpneo.github.com/gmaps/
>>>>>>
>>>>>> mic
>>>>>>
>>>>>>
>>>>>> 2012/6/9 Javier Quarite <[email protected]>:
>>>>>> >> El jueves, 7 de junio de 2012 00:04:29 UTC+2, mcm escribió:
>>>>>> >>>
>>>>>> >>> Help implementig google maps.
>>>>>> >>>
>>>>>> >>> http://hpneo.github.com/gmaps/
>>>>>> >>>
>>>>>> >>> mic
>>>>>> >
>>>>>> >
>>>>>> > What problems do you have?
>>>>>>
>>>>>