Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4085166
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:32:14+00:00 2026-05-20T18:32:14+00:00

First of all, I’m using Rails3 with Ruby 1.9.2. I have a problem using

  • 0

First of all, I’m using Rails3 with Ruby 1.9.2.

I have a problem using PostgreSQL with PostGIS. I’ve tried two gems:

  • https://github.com/nofxx/georuby
  • https://github.com/rgeo/activerecord-postgis-adapter

The problem is, that the first one from nofxx works well, but it doesn’t provide rake tasks, so that the postgis.sql and spatial_ref_sys.sql get inserted into the database. I need this, because it’s comfortable and essential using tests (create automatically the database, insert the postgis sql and perform the migrations when running “rake test”). The strange thing is, that in the README on github the author writes something about PostGIS helpers and rake tasks. But they are not implemented (or I’m blind).

The second gem listed above provides this functionality for rake perfectly! But I ran into an issue that I can’t solve. I followed the instructions in the README, but everytime when I try to set a position on a spatial column, i get the following output:

ruby-1.9.2-p136 :010 > v = Venue.new :location => "POINT(102.0, 47.2)"
=> #<Venue id: nil, last_updated: nil, created_at: nil, updated_at: nil, location: nil>
ruby-1.9.2-p136 :011 > v.location
=> nil 

As you can see, I set a location using WKT (well known text), but it’s always nil. I also tried to save it to the database, but it’s also nil.
I figured out, that when I try to use the Objects provided by RGeo

RGeo::Geos.factory.point(-122, 47)

it says, that the factory is nil. So, there must be a problem by creating the factory provided by RGeo. As mentioned in the README of the activerecord-postgis-adapter I used the following line in my Venue model to provide this support:

self.rgeo_factory_generator = RGeo::Geos.factory_generator

but it doesn’t work.

So to find a solution, there are two ways: Finding a way to get the rake tasks into the georuby gem of nofxx, or solve the problem with the factory of the activerecord-postgis-adapter.

Hope someone can help me,
thx!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:32:14+00:00Added an answer on May 20, 2026 at 6:32 pm

    Finally I solved it on my own. I was playing around with rake tasks and I ran into some issues (like, you can’t provide a password from script with psql…) that anoyed me.
    But i found out, that you can provide a template option to the database.yml file. So, I just wrote:

    development:
      adapter: postgresql
      pool: 5
      encoding: unicode
      database: myDatabase
      username: root
      password: *****
      su_username: root
      su_password: *****
      port: 5432
      template: template_postgis
    
    test:
      adapter: postgresql
      pool: 5
      encoding: unicode
      database: myDatabase_test
      username: root
      password: *****
      su_username: root
      su_password: *****
      port: 5432
      template: template_postgis
    
    production:
      adapter: postgresql
      pool: 5
      encoding: unicode
      database: myDatabase_production
      username: root
      password: *****
      su_username: root
      su_password: *****
      port: 5432
      template: template_postgis
    

    Now every time I create my database (during tests and so on) all the PostGIS stuff gets added! Yeah!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I know how to build a Java application. But I have
First of all: I am not an experienced ClearCase user, but I have lots
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built
First of all, let me say I am very new to rails, have been
I have movies table with movieID,movieName and movieDate. I want to select first all
First of all i have to those categoryIDs 1-whos parentcategoryID only appears one 2-ParentCategoryID
First of all, let me clarify that I know you cannot have actual abstract
First all, I am still learning CakePHP and I am close to ZERO using
First of all Im new to vb 2010 and so far have enjoyed what
First of all I have seen that there are many questions about unrecognized selector

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.