[GRASS-user] Grass SQLite driver & math funtions

Markus Neteler neteler at osgeo.org
Wed Sep 25 17:14:03 PDT 2013


On Wed, Sep 25, 2013 at 11:42 AM, Enrico Gallo <enrico.gallo at gmail.com> wrote:
> Dear list,
> I am struggling with the use of simple math functions in SQL expression,
> using SQLIte and db.execute.
> I am writing a script for multiplatform end-users, so nor compiling SQLite
> math contrib library nor piping data to bc using command line seem to me
> feasable solutions.
>
> Do you have any suggestion?

Could you post an example?

> Including SQLite math functions in the standard binary GRASS GIS
> distribuition could be a long term solution? I think this is the choice
> SpatialLite did since 2.3 version.

You mean
http://www.gaia-gis.it/gaia-sins/spatialite-sql-3.0.0.html#math

hence
http://www.sqlite.org/contrib
--> "extension-functions.c (50.96 KB) contributed by Liam Healy on
2010-02-06 15:45:07
Provide mathematical and string extension functions for SQL queries
using the loadable extensions mechanism. Math: acos, asin, atan, atn2,
atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin,
tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt,
square, ceil, floor, pi. String: replicate, charindex, leftstr,
rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr,
padc, strfilter. Aggregate: stdev, variance, mode, median,
lower_quartile, upper_quartile.
"

If you refer to this file, then it is more related to (your) SQLite
installation rather than GRASS itself since GRASS just calls SQLite.

best,
Markus


More information about the grass-user mailing list