Skip to content
Prev 782 / 1559 Next

RSQLite load extension

Hi there,

this response brings me a bit further but there is still missing some piece in the puzzle. I can now load the 'main' dll (libspatialite-2.dll), and RSQLite is finding the function stubs - however they don't do anything - I guess because the underlying dll's are yet not loaded. And funnily I can't load these dll's (libgeos-3-0-0.dll, libgeos_c-1.dll, libproj-0.dll) in the same manner as libspatialite-2.dll. (They are in the same directory which is on the path.)

So what I get on Windows XP using R 2.9.1 is


library(SQLiteMap)
library(RSQLite)
dbDisconnect(con)
sqli.db <- system.file("sqlimaps/sids.db3", package="SQLiteMap")
drv <- dbDriver("SQLite")
con <- dbConnect(drv, dbname = sqli.db, loadable.extensions = TRUE)
s <- sprintf("select load_extension('%s')","libspatialite-2.dll")
dbGetQuery(con,s)

sql <- 'select isempty(sids.geom) from sids where gid <= 10'
dbGetQuery(con,sql)
  isempty(sids.geom)
1                  -1
2                  -1
..

sql <- 'select centroid(sids.geom) from sids where gid <= 10'
dbGetQuery(con,sql)
  centroid(sids.geom)
1                 <NA>
2                 <NA>
..

.. nice that I don't get an error, but the result is a bit empty ! This I get when I try to load the other dll's ..

sql <- 'SELECT load_extension("libgeos-3-0-0.dll")'
dbGetQuery(con, sql)
Fehler in sqliteFetch(rs, n = -1, ...) : 
  RSQLite driver: (RS_SQLite_fetch: failed first step: The specified procedure could not be found.

unfortunately the links in Gabor's mail don't help the R users
any idea ??

regards
Nick
--- On Sun, 2/21/10, Gabor Grothendieck <ggrothendieck at gmail.com> wrote: