I need to calculate the sin and cos of a vector attribute column, but these functions do not appear to be available. In Python I've tried using v.db.update:

gscript.run_command('v.db.update', map='orientation', column='Z', query_column='COS(AZIMUTH)')

but this was unsuccessful. Does anyone have recommendations?


The problem is that SQLite by default lacks log(), sqrt(), cos(), and other functions. To overcome this limitation you need an addition to SQLite for this: the "SQLite extended functions".

Please check the v.to.db manual page for it in the section Updating of columns with on the fly calculation (SQLite extended functions).

It provides two links (for Linux and Windows) explaining how to compile this library/DLL yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.