[web2py] Re: Virtual field for latitude and longitude from geometry field?

2014-01-03 Thread User
Didn't realize you could make a second query in a Virtual field but makes sense now that I see it. Although I'd rather not make the extra query (2 actually since longitude would need to do the same thing) so I guess I will just add latitude and longitude directly to my original select instead o

[web2py] Re: Virtual field for latitude and longitude from geometry field?

2014-01-03 Thread Paolo Valleri
st_*() are db engine functions, you should query the db to get the output you are looking for. Given that, in your virtual field you should make a new query, something like that: Field.Virtual('latitude', lambda row: db(db.location.id == row.location.id). select(db.location.point.st_x()).first()

[web2py] Re: Virtual field for latitude and longitude from geometry field?

2014-01-02 Thread Christian Foster Howes
i bet that by the time your lambda is running the point has been converted to a string already. can you see if that is true? i'm not sure how to invoke db functions in a lambda of a virtual field. :( On Wednesday, January 1, 2014 5:50:54 PM UTC-8, User wrote: > > Suppose I have a table like: >