I gave it a try.
However it seems all the spatial functionality does not work.
And thats what I need.
Check the "db.execute" lines.

Any ideas?

Thanks,
Jan
#!/usr/bin/env ruby

require 'rubygems'
  require 'sqlite3'

  db = SQLite3::Database.new( "exif.sqlite" )

# Does NOT work:
   db.execute( "SELECT Y(GpsGeometry), 
X(GpsGeometry),DateTime(GpsTimestamp), FromPath FROM ExifPhoto" ) do 
|row|

# Works:
#  db.execute( "SELECT DateTime(GpsTimestamp), FromPath FROM ExifPhoto" 
) do |row|
    p row
  end
  db.close

Result:

NON-WORKING:
me@home:~/python$ ruby ruby.rb
/home/me/.gem/ruby/1.8/gems/sqlite3-ruby-1.2.4/lib/sqlite3/errors.rb:62:in 
`check': no such function: Y (SQLite3::SQLException)
  from 
/home/me/.gem/ruby/1.8/gems/sqlite3-ruby-1.2.4/lib/sqlite3/statement.rb:39:in 
`initialize'
  from 
/home/me/.gem/ruby/1.8/gems/sqlite3-ruby-1.2.4/lib/sqlite3/database.rb:154:in 
`new'
  from 
/home/me/.gem/ruby/1.8/gems/sqlite3-ruby-1.2.4/lib/sqlite3/database.rb:154:in 
`prepare'
  from 
/home/me/.gem/ruby/1.8/gems/sqlite3-ruby-1.2.4/lib/sqlite3/database.rb:181:in 
`execute'
  from ruby.rb:8

WORKING:
me@home:~/python$ ruby ruby.rb
["2008-10-23 14:45:20", "DSCN0029.JPG"]
["2008-10-23 14:41:49", "DSCN0025.JPG"]
["2008-10-23 14:28:17", "DSCN0012.JPG"]
["2008-10-23 14:36:47", "DSCN0021.JPG"]
["2008-10-23 14:54:00", "DSCN0040.JPG"]
["2008-10-23 14:27:07", "DSCN0010.JPG"]
["2008-10-23 14:50:40", "DSCN0038.JPG"]
["2008-10-23 14:57:41", "DSCN0042.JPG"]
["2008-10-23 14:42:29", "DSCN0027.JPG"]

Eric Hodel wrote:
> On Jun 23, 2009, at 23:18, Jan Martin wrote:
>> I am a beginner making a decision on what programing language I spent
>> more time to learn it.
>> In principle I really really like ruby.
>>
>> However for a GIS project of mine I like to use spatialite, a sqlite
>> database with spatial extension:
>> http://www.gaia-gis.it/spatialite/
>>
>> And it seems there is no way to interface it from ruby?
> 
>  From your python code below, it seems to be plain old SQL.
> 
>> def index(req):
>>  data = util.FieldStorage(req)
>>  lat= data['lat'];
>>  lon= data['lon'];
>>
>>  DB = sqlite.connect('exif.sqlite');
>>  DB.enable_load_extension(True);
>>  DB.execute('SELECT load_extension("libspatialite.so")');
> 
> Looks like the ruby equivalent method to this DB.execute would be
> SQLite3::Database#execute, which should handle the same SQL syntax.
> 
>>  );"
>>
>>  DBCursor.execute( strSQL );
> 
> Ditto.

-- 
Posted via http://www.ruby-forum.com/.