In 12 hours or so I'm going on a week long vacation, before I go, I thought 
this could be useful to some people here, even if just as an example, now 
that the DAL supports geo stuff.

This small plugin provides a location picker and a validator for geometry 
(NOT geography) fields that actually represent real points on the map.

The usage is quite simple and here's an example:

from plugin_location_picker import location_widget, IS_GEOLOCATION

db.define_table('point',
    Field('name'),
    Field('coord', 'geometry()', requires=IS_GEOLOCATION(), 
widget=location_widget())
)

Here's a more complex example that makes the map start in the center of 
Lisbon (Everyone should use this):

from plugin_location_picker import location_widget, IS_GEOLOCATION

db.define_table('point',
    Field('name'),
    Field('coord', 'geometry()', requires=IS_GEOLOCATION(), 
widget=location_widget(map_options={'center': {'lat': 38.725275, 'lng': 
-9.150028}}, marker_options={'position': {'lat': 38.725275, 'lng': 
-9.150028}}))
)

Finally, go to appadmin and add points to your point table, verify that you 
now have an awesome widget (well the bootstrap 3 classes probably need 
improvement so the appearance may be odd).

Also, remember to make sure your backend is one of those supported by the 
geoDAL sqlite/spatialite postgres/postgis or mssql. I actually only tested 
this with postgresql and postgis so results may vary.

Respect the BEER-WARE license please.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: web2py.plugin.location_picker.w2p
Description: Binary data

Reply via email to