Skip to content

RSQLite load extension

2 messages · Nick Baumberger, Gabor Grothendieck

#
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:

            
#
sqldf uses libspatiate-1.dll which is from 2.3.1 stable.  I think you
are using the development version.

You might want to use the stable version until you have it working
since there are too many unknowns otherwise.

The main dll seems to load all the others so you its unnecessary to do
that yourself.  For example, try moving the other dll files so that it
cannot find them.  You will get an error when you try to load the main
dll showing that its trying to load the others.
On Mon, Feb 22, 2010 at 6:15 AM, Nick Baumberger <nbaumberger at yahoo.com> wrote: