Thank you Pierre I've add this field to the db:
Field('geopoint', 'geometry()', compute=lambda r: 'POINT({0} {1})'.format(
float(r['longitude']),float(r['latitude']))),
and I've also substitute the geometry filed with this new geopoint filed in
the query:
events_comments = db((db.events_comments.id > 0) & (db.
events_comments.commented_event.geopoint.st_within(geoPolygon((session.west,
session.south), (session.east, session.south), (session.east, session.north
), (session.west, session.north), (session.west, session.south))))).select(
limitby=(0,3),
orderby=~db.events_comments.id
)
Ticket still the same:
'Field' object has no attribute 'geopoint'
Anyway I don't search anymore for a solution concerning this ticket, I'm
not able by myself to resolve it and it seems that the web2py guys don't
know why I have it.
I would like to turn around it making something that perhaps is called a
subquery.
Here i get the events form the area:
events = db(db.events.geometry.st_within(geoPolygon((session.west, session.
south), (session.east, session.south), (session.east, session.north), (
session.west, session.north), (session.west, session.south)))).select()
And I would like to modify this query for having only the comments from the
selected events, something like:
events_comments = db(db.events_comments.
<http://db.events_comments.id/>commented_event ==
events.id).select(
limitby=(0,3),
orderby=~db.events_comments.id
)
Il giorno lunedì 12 dicembre 2016 10:24:41 UTC+1, Pierre ha scritto:
>
> don't know if this relates to your problem
> but I have had issues with the *geoPoint* object in the past and as soon
> as I removed it from my code everything worked fine.....
>
> Try with :
>
> pt = 'POINT({0} {1})'.format(lon,lat)
>
> instead of a geoPoint
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.