Phil,

That plugin still works.
Look in the model file that comes with the plugin.  It tells you how to 
implement the plugin.

Here is a copy of my model, controller and view files where I got it to 
work.
You need to obtain a key from google because if more than a default number
of people visit your site, you will have to pay them for the use. I forget 
what is that specific rule, but you can read their policy.

I haven't tried the plugin wiki yet, but here is what worked for viewing
the map with the plugin.

I have a separate model for loading lat, long data.

model file:
plugin_gmap.py


from gluon.storage import Storage
plugin_gmap=Storage()

plugin_gmap.key='insert_your_string_key_here_from_google' # key for 
localhost  
plugin_gmap.set=db(db.capitals.id>0).select() ### change this to a query 
that lists records with latitude and longitute
#for row in plugin_gmap.set: print 
row.capital_latitude,row.capital_longitude
points=db(db.capitals.id>0).select() ### change this to a query that lists 
records with latitude and longitute
#plugin_gmap.represent=lambda row: '%(first_name)s %(last_name)s' % 
row['auth_user']
plugin_gmap.represent=lambda row: '%(capital_name)s %(capital_latitude)s 
%(capital_longitude)s ' % row
# include plugin in views with {{=LOAD('plugin_gmap')}}

controllers:
 plugin_gmap.py

def index():
    width = request.vars.width or 400
    height = request.vars.height or 300
    #rows = plugin_gmap.set.select()
    rows =  db(db.capitals.id>0).select()    
    for row in rows:
        row.plugin_gmap_popup = plugin_gmap.represent(row)
    return 
dict(width=width,height=height,rows=rows,GOOGLEMAP_KEY=plugin_gmap.key)
   # return 
DIV(width=width,height=height,rows=rows,GOOGLEMAP_KEY=plugin_gmap.key).xml()
idef index():
    width = request.vars.width or 400
    height = request.vars.height or 300
    #rows = plugin_gmap.set.select()
    rows =  db(db.capitals.id>0).select()    
    for row in rows:
        row.plugin_gmap_popup = plugin_gmap.represent(row)
    return 
dict(width=width,height=height,rows=rows,GOOGLEMAP_KEY=plugin_gmap.key)
   # return 
DIV(width=width,height=height,rows=rows,GOOGLEMAP_KEY=plugin_gmap.key).xml()


in view file just put this line in below the 
{{extend 'layout.html'}}

{{=LOAD('plugin_gmap')}}


This combination worked for me.

Margaret


On Monday, September 17, 2012 2:10:48 AM UTC-5, Philip Kilner wrote:
>
> Hi,
>
> I'd like to embed a map in a view, and am trying to use plugin_wiki.
>
> I have plugin_wiki installed, and when I use a simpler function, like the 
> YouTube example: -
>
> {{=plugin_wiki.widget('youtube',code='l7AWnfFRc7g')}}
>
>
> ...all is well.
>
> However, if I try to embed a map, I get a ticket with: -
>
> Traceback (most recent call last):
>   File "/home/philk/web2py/gluon/restricted.py", line 209, in restricted
>     exec ccode in environment
>   File "/home/philk/web2py/applications/myapp/views/property/index.html", 
> line 151, in <module>
> AttributeError: 'PluginWiki' object has no attribute 'map'
>
> Can anyone clue me in as to what I'm  missing?
>
> N.B. I'm new to plugins (most of my apps a re simple CRUD), so I may well 
> have overlooked something fundamental.
>
> Also, when I get it working I'm a bit confused about the need for an API 
> key - the book says "key is the google map api key (default works for 
> 127.0.0.1)", but first of all I don't see a default key, and secondly I see 
> from the docs at: -
>
> https://developers.google.com/maps/signup
>
> ...that the version that needed an API key is deprecated, so I'm concerned 
> that the map plugin itself may be updated.
>
> What would really help me out would be a downloadable app that contained a 
> worked example, if there is such a thing.
>
> ---
>
> Cheers,
>
> PhilK
>
>
>
>
>
>
>
>
>

-- 



Reply via email to