Having trouble with using activerecord-spatialite-adapter

113 views
Skip to first unread message

Sriram Karra

unread,
Mar 11, 2013, 3:06:24 AM3/11/13
to rgeo-...@googlegroups.com

I am trying to build a quick and dirty program to load a shapefile (containing 20,000) polygons into a spatial index. I thought I would do it with Ruby (plain not Rails), ActiveRecord, standalone-migrations, rgeo, spatialite and activerecord-spatialite-adapter. It should be straightforward, I suppose, but perhaps owing to my lack of understanding of Rails itself, I am having issues.

I have a database.yml file I use for establishing ActiveRecord connection:

development:
  adapter: spatialite
  database: db/tz_shapes.sqlite3
  pool: 5
  timeout: 5000

In the documentation available at: https://github.com/dazuma/activerecord-spatialite-adapter it says "…and then change the adapter names to “spatialite” and add an appropriate libspatialite setting." What is meant by an appropriate libspatialite setting?

When I do a rake db:create, firstly I get a message syaing "db/tz_shapes.sqlite3 already exists". Further when I inspect the database file, it is empty and has no tables - specifically the metadata tables etc. So I am unable to run any migrations.

Is there any quite obviously a problem in what I have described so far?

Sriram Karra

unread,
Mar 11, 2013, 10:37:18 PM3/11/13
to rgeo-...@googlegroups.com

On Monday, March 11, 2013 12:36:24 PM UTC+5:30, Sriram Karra wrote:

I am trying to build a quick and dirty program to load a shapefile (containing 20,000) polygons into a spatial index. I thought I would do it with Ruby (plain not Rails), ActiveRecord, standalone-migrations, rgeo, spatialite and activerecord-spatialite-adapter. It should be straightforward, I suppose, but perhaps owing to my lack of understanding of Rails itself, I am having issues.

I have a database.yml file I use for establishing ActiveRecord connection:

development:
  adapter: spatialite
  database: db/tz_shapes.sqlite3
  pool: 5
  timeout: 5000

I added a line "libspatialite: /usr/local/lib/libspatialite.dylib" to the above config, it did not make any difference.

I created a new rails project with the above config, still seeing the same behaviour. Any pointers to get this resolved would be appreciated. It's driving me crazy.

David Douglas

unread,
Mar 11, 2014, 3:40:12 PM3/11/14
to rgeo-...@googlegroups.com
I'm also struggling with this gem. For one it definitely doesn't work with Rails 4. But getting past that I am having trouble at the same step where you are. Unable to open database file w/ the spatialite adapter. Using brewed spatialite adapter located at /usr/local/Cellar/libspatialite/4.1.1/lib/libspatialite.dylib
Reply all
Reply to author
Forward
0 new messages