GithubHelp home page GithubHelp logo

rgeo / activerecord-postgis-adapter Goto Github PK

View Code? Open in Web Editor NEW
854.0 28.0 226.0 1.21 MB

ActiveRecord connection adapter for PostGIS, based on postgresql and rgeo

License: Other

Ruby 100.00%
ruby activerecord postgis postgresql rgeo rails

activerecord-postgis-adapter's Introduction

RGeo

Gem Version CI

RGeo is a geospatial data library for Ruby.

Contributors Wanted!

If you use RGeo and are interested in contributing, please check out our open issues to see if there's anything you're able to help with.

Summary

RGeo is a key component for writing location-aware applications in the Ruby programming language. At its core is an implementation of the industry standard OGC Simple Features Specification, which provides data representations of geometric objects such as points, lines, and polygons, along with a set of geometric analysis operations. This makes it ideal for modeling geolocation data. It also supports a suite of optional add-on modules that provide various geolocation-related services.

Use the core rgeo gem to:

  • Represent spatial and geolocation data objects such as points, lines, and polygons in your Ruby application.
  • Perform standard spatial analysis operations such as finding intersections, creating buffers, and computing lengths and areas.
  • Correctly handle spherical geometry, and compute geographic projections for map display and data analysis.
  • Read and write location data in the WKT and WKB representations used by spatial databases.

Dependencies

RGeo works with the following Ruby implementations:

  • MRI Ruby 2.6.0 or later.
  • Partial support for JRuby 9.0 or later. The FFI implementation of GEOS is available (ffi-geos gem required) but CAPI is not.
  • See earlier versions for support for older ruby versions.

Some features also require the following:

  • GEOS 3.2 or later is highly recommended. (3.3.3 or later preferred.) Some functions will not be available without it. This C/C++ library may be available via your operating system's package manager (sudo aptitude install libgeos-dev for debian based Linux distributions, yum install geos geos-devel for redhat based Linux distributions), or you can download it from http://trac.osgeo.org/geos
  • On some platforms, you should install the ffi-geos gem (version 1.2.0 or later recommended.) JRuby requires this gem to link properly with Geos, and Windows builds probably do as well.

Installation

Install the RGeo gem:

gem install rgeo

or include it in your Gemfile:

gem "rgeo"

If you are using proj.4 extensions, include rgeo-proj4:

gem "rgeo-proj4"

Upgrading to Version 3.0

See doc/Upgrading-to-v3.md for a checklist of changes to make before upgrading to RGeo 3.0.

For a brief overview of the changes, see NEWS.md.

For a comprehensive list of all changes, see History.md.

Extensions

The RGeo organization provides several gems that extend RGeo:

Proj4 extensions

Read and write GeoJSON

Read ESRI shapefiles

ActiveRecord connection adapter for PostGIS, based on postgresql (pg gem)

ActiveRecord connection adapter for MySQL Spatial Extensions, based on mysql2

ActiveRecord connection adapter for SpatiaLite, based on sqlite3 (*not maintained)

Development and support

RDoc Documentation is available at https://www.rubydoc.info/gems/rgeo

Contributions are welcome. Please read the Contributing guidelines.

Support may be available on the rgeo-users google group or on Stack Overflow.

Documentation

You can see more in-depth documentation in the doc folder. Factories and methods are documented inline, you should consider checking https://rubydoc.info/gems/rgeo with the version you are currently using. Or generate documentation locally if you're working on RGeo: yardoc server.

Here's the current list of available topics:

You can see an exhaustive and up to date list at https://rubydoc.info/gems/rgeo/index.

Acknowledgments

Daniel Azuma created RGeo. Tee Parham is a former maintainer. Keith Doggett, Ulysse Buonomo are current maintainers.

Development is supported by:

RGeo calls the GEOS library to handle most Cartesian geometric calculations, and the Proj4 library to handle projections and coordinate transformations. These libraries are maintained by the Open Source Geospatial Foundation; more information is available on OSGeo's web site.

JRuby support is made possible by the ffi-geos (and upcoming ffi-proj4) gems, by J Smith.

License

Copyright (c) Daniel Azuma, Tee Parham

License

activerecord-postgis-adapter's People

Contributors

berkos avatar dazuma avatar ddiachkov avatar formigarafa avatar frehoy avatar glaszig avatar gui avatar joenoon avatar joseramonc avatar keithdoggett avatar legendetm avatar matthewrudy avatar mikebobrov avatar mitinpavel avatar mrnugget avatar nbulaj avatar petergoldstein avatar phlegx avatar plarson avatar rhodrid avatar satom9to5 avatar seuros avatar stevejackson avatar stuarth avatar tagliala avatar teeparham avatar thibaudgg avatar tristramg avatar vvalgis avatar workmad3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

activerecord-postgis-adapter's Issues

db:create doesn't initialize postgis "enough"?

when i do a db:create and look at the schema, i see lots of the postgis declarations, but when I try to create a table with a geometry column it fails with "no such type geometry"

however... if before running this migration i do psql mydatabase < path/to/postgis.sql
...
it works

so looking at the schema after this i have 2 declarations for CREATE TYPE geometry (...)
(well 4, the prototype and implementation twice)

i don't know if this second declaration is in some sort of different "schema" i'm not even really sure what these schema things are, or how search path works....

here is my datase.yml
development:
adapter: postgis
schema_search_path: "public,postgis"
script_dir: /usr/share/postgresql/9.1/contrib/postgis-1.5/
encoding: unicode
database: mydb_development
pool: 25
username: fringd
password:
su_username: fringd
su_password:

test:
adapter: postgis
schema_search_path: "public,postgis"
script_dir: /usr/share/postgresql/9.1/contrib/postgis-1.5/
encoding: unicode
database: mydb_test
pool: 25
username: fringd
password:
su_username: fringd
su_password:

any help would be greatly appreciated, I've tried to follow the README as best as possible...

Weird geometry lookups on queries

Hello,

Only one activerecord model in our schema uses geolocation, like in:

t.point :location, :geographic => true, :srid => 4326

This model A is related to another one B, and B has other relations.

The weird thing is that postgis looks into other B relations classes for geometry columns, have you ever experienced this?

We have everywhere in the console calls like that.

1.9.3p286 :031 > j.articles # articles are not the models with location

   (1.3ms)  SELECT * FROM geometry_columns WHERE f_table_name='articles'
   (1.6ms)  SELECT * FROM geometry_columns WHERE f_table_name='comments'
  Article Load (1.0ms)  SELECT "articles".* FROM "articles" INNER JOIN "comments" ON "articles"."id" = "comments"."article_id" WHERE "articles"."journal_id" = 148
 => []

Thanks!

running on Heroku

Have you tried running your adapter on Heroku? Out of the box you end up needing to modify the Heroku config variable DATABASE_URL to use the 'postgis' adapter. Wondering if you had any suggestions on how to do this without editing the DATABASE_URL, so things like heroku pg:promote still works.

Spork/Guard with Postgis

We're using the Postgis adapter, and I'm trying to setup Guard and Spork to speed up our time spent running tests. Our test pass flawlessly when not using the Spork server, but once we run it on the Spork server, we get an exception.

NoMethodError:
undefined method `point' for #<Proc:0x007ff23e9697f8>

This exception is being thrown by this line of code:

self.coords = self.class.rgeo_factory_generator.point(geo.last, geo.first)

Weird geometry lookups on queries

Hello,

I'm sorry, but has many people, I consider the subject opened six months ago by @rodrigues as an issue: #36

Each time a query is made on a model, an ar-postgis-adapter query is made too, even on models that don't use any spatial data. What an overload for servers... These queries are sometimes cached, sometimes not.

Example :

(5.6ms)  SELECT * FROM geometry_columns WHERE f_table_name='srlzd_infos'
SrlzdInfo Load (1.1ms)  SELECT "srlzd_infos".* FROM "srlzd_infos" WHERE "srlzd_infos"."user_id" = 1009 LIMIT 1

(5.5ms)  SELECT * FROM geometry_columns WHERE f_table_name='settings'
Setting Load (1.8ms)  SELECT "settings".* FROM "settings" WHERE "settings"."user_id" = 1009 LIMIT 1

Is there a way, or do you plan to have an ar-postgis-adapter config file in which we could declare which models are using spatial fields?

Thanks for your great work and thanks for your answer Dazuma.

Cheers
gozup

Any tables with an index complain it "Could not dump table" in schema.rb

After adding in activerecord-postgis-adapter gem and running rake db:gis:setup and rake db:migrate schema.rb complains that it couldn't dump the table, even though the tables with the indexes have no spatial or geographic columns or indexes. See the error below in db/schema.rb.

# Could not dump table "my_table_name" because of following NoMethodError
# undefined method `using' for #<RGeo::ActiveRecord::SpatialIndexDefinition:0x007f8e6e77ce38>

20 km shift with SRID 32188

Hi!

I tried to convert a lat/lon geographic geometry to MTM8 (SRID 32188) and I get a 20km shift (almost 20000 meters too high) for the y, but the x is correct.

If I use directly the postgis function ST_Transform, there is no shift.

Here is the rgeo command I use to transform (the one that shifts 20km):
RGeo::Feature.cast(geometry_attribute, :factory => RGeo::Cartesian.factory(:srs_database => RGeo::CoordSys::SRSDatabase::ActiveRecordTable.new, :srid => 32188), :project => true)

Thanks for any cue!

Update error

I have

gem 'activerecord-postgis-adapter', '0.3.5'

in my gem file and I get this error

Bundler could not find compatible versions for gem "arel":
activerecord-postgis-adapter (= 0.3.5) depends on
arel (2.1.1)

Shouldn't this install arel automatically? This is only happening when I am trying to update to rails 3.0.7 as well. The full error looks like this

Bundler could not find compatible versions for gem "arel":
  In Gemfile:
    rails (= 3.0.7) depends on
      arel (~> 2.0.2)

    activerecord-postgis-adapter (= 0.3.5) depends on
      arel (2.1.1)

I'm not sure if this a rails issue or an adapter issue.

PG::Error: ERROR: relation "geometry_columns" does not exist

I was trying to get PostGIS 2.0.2 working with PostgreSQL 9.2.2 and this adapter and it was not working, even though I followed the tutorial to the dot. At first I thought it was my completely my fault but even though I removed PostGIS and all its remnants and reinstalled it, I was still getting this error with rake db:create

PG::Error: ERROR:  relation "geometry_columns" does not exist
: ALTER TABLE geometry_columns OWNER TO username
/Users/username/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:652:in `async_exec'

After a long while, I decided to try with the latest master, which works splendidly.

This is my database.yml:

development:
  adapter: postgis
  schema_search_path: "public,postgis,topology"
  su_username: postgres
  su_password: postgres
  encoding: unicode
  database: database_development
  pool: 5
  timeout: 5000
  username: user
  password: user
  host: localhost
  postgis_extension: "postgis,postgis_topology"

Is there anything in the latest release gem that prevents this setup from working?

Does not detect correct table_name for nested models.

(I've only tested this with the gem version 0.4.2)

If you create a nested model, e.g. with rails generate model foo/bar the default is for the model to have the table name 'foo_bars'. This is done via the automatically created app/models/foo.rb which contains the following definition (and is reflected in the generated migration):

module Foo
  def self.table_name_prefix
    'foo_'
  end
end

When you try to access e.g. Foo::Bar.all in the console it leads to the following error:

SELECT * FROM geometry_columns WHERE f_table_name='bars'
ActiveRecord::StatementInvalid: PG::Error: ERROR:  relation "bars" does not exist
LINE 4:              WHERE a.attrelid = '"bars"'::regclass
                                        ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '"bars"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum

Obviously, it should be using 'foo_bars' instead. This error does not occur when using the regular sqlite or postgresql adapter (though they don't, of course, query the table 'geometry_columns').

Adding self.table_name = 'foo_bars' to app/models/foo/bar.rb is a temporary fix, but should not be necessary.

db:schema:dump fails for undefined geometry columns

Output:

** Invoke db:schema:dump (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:schema:dump
rake aborted!
undefined method `type_name' for nil:NilClass
/home/pi/.rvm/gems/ruby-1.8.7-p299/gems/activesupport-3.0.4/lib/active_support/whiny_nil.rb:48:in `method_missing'
/home/pi/.rvm/gems/ruby-1.8.7-p299/gems/activerecord-postgis-adapter-0.3.2/lib/active_record/connection_adapters/postgis_adapter/spatial_column.rb:79:in `initialize'

Causing table has a geometry column, but no constraints and no entry in geometry_columns.

To fix it, line 78 of spatial_column.rb has to be changed to:

if type == :spatial && !@geometric_type.nil?

Enhancement - rake db:postgis:install or similar

If you add postgis to a project part-way through development, there's no handy way to add postgis to your existing databases. Setting up script_dir currently only works for db:create.

To save having to do the command line psql -d foo -f /path/to/postgis.sql etc, it would be create if there was a rake task , such as rake db:postgis:install that did the required stuff based on the database.yml config options.

Failing that, it would help to clarify in the documentation which steps are needed in order to convert an existing rails project into a postgis-adapter based project.

`geographic: true` doesn't force SRID 4326

Despite what the docs say, geographic: true doesn't force the SRID to be set to 4326. (I'm using Postgres.app [so PGSQL 9.2] with Rails 3.0 and Ruby 1.9.2 on Mac OS X 10.8.)

Weird behavior with geometry_columns

I am performing a threading operation that has a couple of activerecord database queries. In a development environment it calls geometry_columns only once and caches the data but in a production environment it calls geometry_columns every single time which slows down the query by seconds. I am not sure why this is happening

I also have marked the active record queries with ActiveRecord::Base.connection_pool.with_connection do to makes sure the connections close after the thread. Is there any way to turn off the geometry_columns caching and tell it exactly where the spatial column is?

Another way to handle the tests creating the postgis tables

A very simple solution to the avoiding having the postgis functions in their own schema is to not put postgis in the search path, then have a setting for the script_dir for the databases other than test. Not 100% sure why this works, but I think this causes the rake task to put the functions into the public schema where they are ignored and for test to not execute the scripts.

Issue on storing data with wkt string into a goegraphic polygon column.

Hi, I have a table with a geographic polygon column.

add_column :mytable, :area, :polygon, :geographic=>true, :srid=>4326

That me describe the problem a bit:
So, I'm trying to import some polygon data into the column above. The data is in WKT format (which are collected from a KML file, i think it doesn't matter here). Most of the data is imported well, but just one polygon data wont be imported, the area kept return nil. The wkt is as below:

"POLYGON((144.953500981593265 -37.755336568377764,144.979974380619751 -37.758248642270679,144.9871221983569 -37.765131726017557,145.027891232857655 -37.767514331929945,145.022596553052352 -37.778633159521064,145.012801395412566 -37.78233943538477,145.017037139256814 -37.784722041297151,145.019155011178924 -37.803518154605946,145.011742459451511 -37.817019588109446,145.016242937285995 -37.827079479739503,145.027626498867392 -37.832903627525333,145.006183045655945 -37.832903627525333,144.994270016094049 -37.832374159544806,144.984739592444498 -37.826814745749246,144.982886454512652 -37.83343309550586,144.976532838746294 -37.832638893535069,144.969120287018882 -37.81913746003157,144.971502892931255 -37.801400282683829,144.915114553004884 -37.800606080713038,144.902672055462432 -37.79028145509271,144.911408277141135 -37.780221563462646,144.933116464342874 -37.780486297452917,144.948471035778226 -37.777044755579475,144.950588907700336 -37.757189706309617,144.950588907700336 -37.757189706309617,144.953500981593265 -37.755336568377764))"

The other polygons are in exactly same format. And the kml file is working properly on google earth including this polygon.

Is there anyway to validate the format of the string? Or how am i suppose to find out what is going wrong?

Thanks a lot!

can't create POLYHEDRALSURFACE

The title says it all. Anytime I try to create a POLYHEDRALSURFACE the attribute is nil when i read it back.

Here's one of the failing ones

"POLYHEDRALSURFACE(((-122.11829337775245 37.38069297281639 54.58596039, -122.11780138990547 37.38069297281639 54.58596039, -122.11780138990547 37.38027158034676 54.58596039, -122.11829337775245 37.38027158034676 54.58596039, -122.11829337775245 37.38069297281639 54.58596039 )),((-122.11829337775245 37.38069297281639 66.94806331, -122.11780138990547 37.38069297281639 66.94806331, -122.11780138990547 37.38027158034676 66.94806331, -122.11829337775245 37.38027158034676 66.94806331, -122.11829337775245 37.38069297281639 66.94806331 )),((-122.11829337775245 37.38069297281639 66.94806331, -122.11780138990547 37.38069297281639 66.94806331, -122.11780138990547 37.38069297281639 54.58596039, -122.11829337775245 37.38069297281639 54.58596039, -122.11829337775245 37.38069297281639 66.94806331 )),((-122.11780138990547 37.38069297281639 66.94806331, -122.11780138990547 37.38069297281639 54.58596039, -122.11780138990547 37.38027158034676 54.58596039, -122.11780138990547 37.38027158034676 66.94806331, -122.11780138990547 37.38069297281639 66.94806331 )),((-122.11780138990547 37.38027158034676 66.94806331, -122.11780138990547 37.38027158034676 54.58596039, -122.11829337775245 37.38027158034676 54.58596039, -122.11829337775245 37.38027158034676 66.94806331, -122.11780138990547 37.38027158034676 66.94806331 )),((-122.11829337775245 37.38027158034676 66.94806331, -122.11829337775245 37.38069297281639 66.94806331, -122.11829337775245 37.38069297281639 54.58596039, -122.11829337775245 37.38027158034676 54.58596039, -122.11829337775245 37.38027158034676 66.94806331)))"

Objects not parsed when using spatial functions in queries

I may be doing something wrong but with postgis 2.0 when I try a spatial function like:

select("st_extent(the_geom) as extent").first.extent

it only returns the WKT representation of the query:

=> "BOX(-124.482003 25.8371639999266,-69.858861 42.88679)"

Is there a way to automatically parse these meta columns when they return from the database?

db:schema:load fails with "geography type does not exist"

Hi there,

I'm using Rails 3.2.8, and activerecord-postgis-adapter 0.5.1.

Everything is working, until I tried to use rspec. When I run "rake spec" and it tries to reload the testing database, things fail when one of my tables is created:

PG::Error: ERROR:  type "geography" does not exist
LINE 1: ...r, "photo_url" character varying(255), "location" GEOGRAPHY(...
                                                             ^
: CREATE TABLE "locations" ("id" serial primary key, "lat" float, "lng" float, "author" character varying(255), "description" text, "season_start" integer, "season_stop" integer, "no_season" boolean, "address" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "unverified" boolean DEFAULT 'f', "quality_rating" integer, "yield_rating" integer, "access" integer, "import_id" integer, "photo_url" character varying(255), "location" GEOGRAPHY(POINT,4326)) 

AFAIK this isn't legal PostGIS syntax. The geography column should be created on a second line that calls the add geography function. I'm not sure where in Rails or this adapter the SQL gets generated, but it seems like a bug to me.

Halp?

postgis stopped working when i upgrade from rails 3.0 to 3.2

I got this error after upgrading from 3.0 to 3.2. I've read it might have to do with Quoting module... Any idea?

Here is how the location field is set:

self.location = RGeo::Geographic.spherical_factory(:srid => 4326).point(self.longitude, self.latitude)

Here is the error message:

PGError: ERROR:  parse error - invalid geometry
HINT:  You must specify a valid OGC WKT geometry type such as POINT, LINESTRING or POLYGON

activerecord (3.2.12) lib/active_record/connection_adapters/postgresql_adapter.rb:1166:in `get_last_result'
activerecord (3.2.12) lib/active_record/connection_adapters/postgresql_adapter.rb:1166:in `exec_cache'
activerecord (3.2.12) lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `block in exec_query'
activerecord (3.2.12) lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
activesupport (3.2.12) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activerecord (3.2.12) lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
newrelic_rpm (3.6.1.88) lib/new_relic/agent/instrumentation/active_record.rb:36:in `block in log_with_newrelic_instrumentation'
newrelic_rpm (3.6.1.88) lib/new_relic/agent/method_tracer.rb:273:in `trace_execution_scoped'
newrelic_rpm (3.6.1.88) lib/new_relic/agent/instrumentation/active_record.rb:33:in `log_with_newrelic_instrumentation'
activerecord (3.2.12) lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `exec_query'
activerecord (3.2.12) lib/active_record/connection_adapters/abstract/database_statements.rb:63:in `exec_insert'
activerecord (3.2.12) lib/active_record/connection_adapters/abstract/database_statements.rb:90:in `insert'
activerecord (3.2.12) lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
activerecord (3.2.12) lib/active_record/relation.rb:66:in `insert'
activerecord (3.2.12) lib/active_record/persistence.rb:367:in `create'
activerecord (3.2.12) lib/active_record/timestamp.rb:58:in `create'
activerecord (3.2.12) lib/active_record/callbacks.rb:268:in `block in create'
activesupport (3.2.12) lib/active_support/callbacks.rb:403:in `_run__596866374__create__56924577__callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.12) lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.12) lib/active_record/callbacks.rb:268:in `create'
activerecord (3.2.12) lib/active_record/persistence.rb:348:in `create_or_update'
activerecord (3.2.12) lib/active_record/callbacks.rb:264:in `block in create_or_update'
activesupport (3.2.12) lib/active_support/callbacks.rb:458:in `_run__596866374__save__56924577__callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.12) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.12) lib/active_record/callbacks.rb:264:in `create_or_update'
activerecord (3.2.12) lib/active_record/persistence.rb:84:in `save'
activerecord (3.2.12) lib/active_record/validations.rb:50:in `save'
activerecord (3.2.12) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (3.2.12) lib/active_record/transactions.rb:259:in `block (2 levels) in save'
activerecord (3.2.12) lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
activerecord (3.2.12) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.12) lib/active_record/transactions.rb:208:in `transaction'
newrelic_rpm (3.6.1.88) lib/new_relic/agent/method_tracer.rb:523:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
newrelic_rpm (3.6.1.88) lib/new_relic/agent/method_tracer.rb:273:in `trace_execution_scoped'
newrelic_rpm (3.6.1.88) lib/new_relic/agent/method_tracer.rb:518:in `transaction_with_trace_ActiveRecord_self_name_transaction'
activerecord (3.2.12) lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
activerecord (3.2.12) lib/active_record/transactions.rb:259:in `block in save'
activerecord (3.2.12) lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
activerecord (3.2.12) lib/active_record/transactions.rb:258:in `save'
app/controllers/properties_controller.rb:313:in `create'

PostgreSQL dependency

It might be worth listing PostgreSQL 9 as a dependency in the README. GRANT ... ALL TABLES ... and plpgsql being installed by default are both presumed, which are both features of 9+ only.

rake db:test:prepare doesn't work

Can't run rake db:test:prepare. rake db:migrate seems to run fine.

psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:27: ERROR:  relation "accounts" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:39: ERROR:  relation "accounts_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:60: ERROR:  relation "authentications" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:72: ERROR:  relation "authentications_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:101: ERROR:  relation "locations" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:113: ERROR:  relation "locations_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:135: ERROR:  relation "member_locations" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:147: ERROR:  relation "member_locations_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:166: ERROR:  relation "members" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:178: ERROR:  relation "members_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:202: ERROR:  relation "oauth_access_grants" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:214: ERROR:  relation "oauth_access_grants_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:238: ERROR:  relation "oauth_access_tokens" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:250: ERROR:  relation "oauth_access_tokens_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:272: ERROR:  relation "oauth_applications" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:284: ERROR:  relation "oauth_applications_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:300: ERROR:  relation "schema_migrations" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:317: ERROR:  relation "users" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:329: ERROR:  relation "users_id_seq" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:407: ERROR:  multiple primary keys for table "accounts" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:415: ERROR:  multiple primary keys for table "authentications" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:423: ERROR:  multiple primary keys for table "locations" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:431: ERROR:  multiple primary keys for table "member_locations" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:439: ERROR:  multiple primary keys for table "members" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:447: ERROR:  multiple primary keys for table "oauth_access_grants" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:455: ERROR:  multiple primary keys for table "oauth_access_tokens" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:463: ERROR:  multiple primary keys for table "oauth_applications" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:471: ERROR:  multiple primary keys for table "users" are not allowed
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:478: ERROR:  relation "index_accounts_on_user_id" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:485: ERROR:  relation "index_authentications_on_provider_and_uid" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:492: ERROR:  relation "index_authentications_on_user_id" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:499: ERROR:  relation "index_locations_on_account_id" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:506: ERROR:  relation "index_locations_on_guest_key" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:513: ERROR:  relation "index_locations_on_member_key" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:520: ERROR:  relation "index_member_locations_on_member_id_and_location_id" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:527: ERROR:  relation "index_member_locations_on_permissions" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:534: ERROR:  relation "index_members_on_phone_number" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:541: ERROR:  relation "index_oauth_access_grants_on_token" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:548: ERROR:  relation "index_oauth_access_tokens_on_refresh_token" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:555: ERROR:  relation "index_oauth_access_tokens_on_resource_owner_id" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:562: ERROR:  relation "index_oauth_access_tokens_on_token" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:569: ERROR:  relation "index_oauth_applications_on_uid" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:576: ERROR:  relation "index_users_on_email" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:583: ERROR:  relation "index_users_on_profile_id_and_profile_type" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:590: ERROR:  relation "unique_schema_migrations" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:597: ERROR:  rule "geometry_columns_delete" for relation "geometry_columns" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:604: ERROR:  rule "geometry_columns_insert" for relation "geometry_columns" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:611: ERROR:  rule "geometry_columns_update" for relation "geometry_columns" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:135: ERROR:  type "hstore" does not exist
LINE 4:     permissions hstore,
                        ^
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:154: ERROR:  relation "member_locations" does not exist
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:364: ERROR:  relation "member_locations" does not exist
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:431: ERROR:  relation "member_locations" does not exist
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:520: ERROR:  relation "member_locations" does not exist
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:527: ERROR:  relation "member_locations" does not exist
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:597: ERROR:  rule "geometry_columns_delete" for relation "geometry_columns" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:604: ERROR:  rule "geometry_columns_insert" for relation "geometry_columns" already exists
psql:/Users/anthonator/Documents/Projects/clients/circle911/db/development_structure.sql:611: ERROR:  rule "geometry_columns_update" for relation "geometry_columns" already exists

shp2pgsql cannot find postgis functions when using postgis schema

I have setup my environment as per documentation and added postgis to schema_search_path. When I try to load data using shp2pgsql i get an error saying that the addGeometryColumn postgis function cannot be found. I gather its because the function its in a different schema than public. Is there a solution to this issue?

Saving a Polygon with WFT format

hi, thanks for this great gem and all the other associated gems, great work.

I have a problem though and its probably because i am being stupid, but i have tried to read as much as i can and i just cannot figure it out..

i am trying to save a polygon to the db by supplying a polygon in WFT.

a.geometry = "POLYGON((1.7162916854424444 103.45203161621089, 1.4678221588572677 103.42868566894526, 1.250903373422990
=> "POLYGON((1.7162916854424444 103.45203161621089, 1.4678221588572677 103.42868566894526, 1.2509033734229906 103.75003576660151, 1.6682474647616954 104.06726599121089, 1.7162916854424444 103.45203161621089))" 
ruby-1.9.2-p290 :005 > a.geometry
=> nil 
ruby-1.9.2-p290 :006 > a.save

as you can see the geometry column does not get set but know error. if i try a simple set of integers all seems to work:

ruby-1.9.2-p290 :046 > a.geometry = "POLYGON((35 10, 10 20, 15 40, 45 45, 35 10))"
=> "POLYGON((35 10, 10 20, 15 40, 45 45, 35 10))" 
ruby-1.9.2-p290 :047 > a.save
(0.2ms)  BEGIN
(0.6ms)  UPDATE "areas" SET "geometry" = '0020000003000010e600000001000000054041800000000000402400000000000040240000000000004034000000000000402e00000000000040440000000000004046800000000000404680000000000040418000000000004024000000000000', "updated_at" = '2012-01-24 21:49:35.021586' WHERE "areas"."id" = 1
(1.1ms)  COMMIT
=> true 

my migration looks like this:

class CreateAreas < ActiveRecord::Migration

  def self.up
    create_table :areas do |t|
      t.string :name         
      t.references :account 
      t.string :color
      t.string :description      
      t.polygon :geometry, :geographic => true
      t.timestamps
    end

    add_index :areas, :name
    add_index :areas, :geometry, :spatial => true
  end

  def self.down
    drop_table :areas
  end  

end   

and by model:

class Area < ActiveRecord::Base 
  set_rgeo_factory_for_column(:geometry, RGeo::Geographic.spherical_factory)
  belongs_to :account  
end

Any help would be much appreciated, many thanks

Operation on mixed SRID geometries

Using this script:

require 'my_app'

class Beacon < ActiveRecord::Base
  FACTORY = RGeo::Geographic.simple_mercator_factory
  set_rgeo_factory_for_column(:loc, FACTORY.projection_factory)
end

r = [[41.3651383072336, -81.7574678409778], [41.4012505816552, -81.7093377145778]]
f = Beacon::FACTORY
loc = f.line_string([f.point(r[0][1], r[0][0]), f.point(r[1][1], r[1][0])])
loc = loc.projection

p Beacon.where("st_intersects(?::geometry, loc)", loc).limit(1)

I get the error "Operation on mixed SRID geometries":

$ psql beacons -c "select st_srid(loc) from beacons limit 1;"
 st_srid 
---------
    4326
(1 row)

$ ruby foo.rb
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in `async_exec': PG::Error: ERROR:  Operation on mixed SRID geometries (ActiveRecord::StatementInvalid)
: SELECT  "beacons".* FROM "beacons"  WHERE (st_intersects('002000000200000ec900000002c1615bf1f6090d894153539b655389c2c16159543bc2169d415358d6d9e40c56'::geometry, loc)) LIMIT 1

And that's after I manually inserted the ::geometry cast. Shouldn't the adapter translate the RGeo::Geos::CAPILineStringImpl to the correct postgresql representation automatically?

Rails 4 db:migrate broken - undefined method `non_geographic_spatial_columns'

$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
==  CreatePostgisExtensions: migrating ========================================
-- execute("CREATE EXTENSION postgis;")
   -> 1.0280s
-- execute("CREATE EXTENSION postgis_topology;")
   -> 0.5671s
==  CreatePostgisExtensions: migrated (1.5953s) ===============================

==  CreateCountries: migrating ================================================
-- create_table(:countries)
rake aborted!
An error has occurred, this and all later migrations canceled:

undefined method `non_geographic_spatial_columns' for ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x007f02724f6a48~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rgeo-activerecord-0.5.0/lib/rgeo/active_record/common_adapter_elements.rb:107:in `method_missing'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/activerecord-postgis-adapter-77bef269ffe3/lib/active_record/connection_adapters/postgis_adapter/rails4/main_adapter.rb:204:in `create_table'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:622:in `block in method_missing'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:594:in `block in say_with_time'
~/.rvm/rubies/ruby-2.0.0-p0-perf/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:594:in `say_with_time'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:614:in `method_missing'
~/work/geo_test/db/migrate/20130327124031_create_countries.rb:3:in `change'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:568:in `exec_migration'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:552:in `block (2 levels) in migrate'
~/.rvm/rubies/ruby-2.0.0-p0-perf/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:551:in `block in migrate'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:302:in `with_connection'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:550:in `migrate'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:702:in `migrate'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:896:in `block (2 levels) in migrate'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:976:in `block in ddl_transaction'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/transactions.rb:209:in `transaction'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:976:in `ddl_transaction'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:895:in `block in migrate'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:891:in `each'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:891:in `migrate'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:747:in `up'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/migration.rb:725:in `migrate'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bundler/gems/rails-30fbbb4ce378/activerecord/lib/active_record/railties/databases.rake:48:in `block (2 levels) in '
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
~/.rvm/rubies/ruby-2.0.0-p0-perf/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/bin/rake:33:in `'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bin/rake:23:in `load'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bin/rake:23:in `'
Tasks: TOP => db:migrate

Postgres Array crashes when saving in Rails 4 rc1

I've just upgraded my app to rails 4 and have been getting an inexplicable error when running some specs. After doing some digging in the console it turns out that, when I try to save an array, there seems to be something weird happening with the type conversions in the adapter.

   (0.4ms)  BEGIN
  Place Load (12.3ms)  SELECT "places".* FROM "places" WHERE "places"."id" = $1 LIMIT 1  [["id", 1]]
  SQL (5.4ms)  INSERT INTO "popups" ("created_at", "place_id", "tags", "text", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"  [["created_at", Mon, 13 May 2013 06:25:39 UTC +00:00], ["place_id", 1], ["tags", ["lol"]], ["text", "hi"], ["updated_at", Mon, 13 May 2013 06:25:39 UTC +00:00], ["user_id", 1]]
ArgumentError: wrong number of arguments (3 for 2): INSERT INTO "popups" ("created_at", "place_id", "tags", "text", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"
   (0.5ms)  ROLLBACK
ArgumentError: wrong number of arguments (3 for 2)
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-postgis-adapter-0.6.3/lib/active_record/connection_adapters/postgis_adapter/shared/common_adapter_methods.rb:106:in `type_cast'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/cast.rb:76:in `block in array_to_string'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/cast.rb:71:in `map'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/cast.rb:71:in `array_to_string'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/quoting.rb:103:in `type_cast'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-postgis-adapter-0.6.3/lib/active_record/connection_adapters/postgis_adapter/shared/common_adapter_methods.rb:110:in `type_cast'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:748:in `block in exec_cache'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:747:in `map'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:747:in `exec_cache'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/database_statements.rb:139:in `block in exec_query'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract_adapter.rb:425:in `block in log'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activesupport-4.0.0.rc1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract_adapter.rb:420:in `log'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/database_statements.rb:183:in `exec_insert'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:96:in `insert'
... 17 levels...
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/transactions.rb:270:in `block (2 levels) in save'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/transactions.rb:209:in `transaction'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/transactions.rb:270:in `block in save'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/transactions.rb:281:in `rollback_active_record_state!'
    from /Users/christopherbull/.rvm/gems/ruby-1.9.3-p392@popin/gems/activerecord-4.0.0.rc1/lib/active_record/transactions.rb:269:in `save'

Compatibility with postgres_ext

Maybe this isn't an activerecord-postgis-adapter issue as such, without diving very deep in I can't tell. But when I try to use postgres_ext it seems to conflict with postgis:

m = ModelWithIntegerArray.new => [snip] m.integer_array_field = [1,2] => [1,2] 1.9.3p194 :006 > m ArgumentError: wrong number of arguments (3 for 4) from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-postgis-adapter-0.4.3/lib/active_record/connection_adapters/postgis_adapter/spatial_column.rb:52:in initialize'
from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/attribute_methods/read.rb:84:in new' from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/attribute_methods/read.rb:84:in temp'
from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/attribute_methods/read.rb:46:in type_cast_attribute' from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/attribute_methods/read.rb:127:in read_attribute'
from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/attribute_methods.rb:203:in attribute_for_inspect' from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/base.rb:643:in block in inspect'
from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/base.rb:641:in collect' from /Users/james/.rvm/gems/ruby-1.9.3-p194@project/gems/activerecord-3.2.6/lib/active_record/base.rb:641:in inspect'`

Do you have any thoughts or ideas as to how this could be happening or what I could do to fix it? I have tried manually requiring the postgres_ext library, to no avail.

thanks!

James

Can't run tests for new rails projects using postgis

Reproduction steps:

  1. Create a new rails app
  2. Set up a corresponding postgis database
  3. Configure according to the instructions for the adapter
  4. run "rake test" or "rake spec"
  5. Get error:
    You have a nil object when you didn't expect it!
    The error occurred while evaluating nil.[]
    rgeo-activerecord-0.2.4/lib/rgeo/active_record/task_hacker.rb:57:in 'call'

configs_for_environment fail on rails 3.0.x

Running rake db:gis:setup for an existing rails app (v.3.0.10) fails on configs_for_environment.

databases.rake

    task :setup => [:load_config, :rails_env] do
      configs_for_environment.each { |config| setup_gis(config) }
    end

Error on rake db:gis:setup

** Invoke db:gis:setup (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Invoke rails_env
** Execute db:gis:setup
rake aborted!
undefined local variable or method `configs_for_environment' for main:Object
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@dfms/gems/activerecord-postgis-adapter-0.6.3/lib/active_record/connection_adapters/postgis_adapter/rails3/databases.rake:53:in `block (3 levels) in <top (required)>'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/rupert/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
Trying to 

/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@dfms/bin/rake:19:in `load'
/Users/rupert/.rvm/gems/ruby-1.9.3-p0@dfms/bin/rake:19:in `<main>'
Tasks: TOP => db:gis:setup

Rails dbconsole doesn't work

Using postgis as adapter in my config/database.yml, I can't use rails dbconsole. Error is:
Unknown command-line client for mydbname. Submit a Rails patch to add support!
Am I missing some configuration?

Unable to save geometries in Rails 3.2

When saving under Rails 3.2 I get this error:

NoMethodError: undefined method `rgeo_factory_settings' for Module:Class

I tracked it down to:

https://github.com/dazuma/activerecord-postgis-adapter/blob/master/lib/active_record/connection_adapters/postgis_adapter/spatial_column.rb#L136

This code assumes 'self' is the instance of the model but it's actually a weird Module created on the fly. The module_eval it runs in is here:

https://github.com/rails/rails/blob/master/activerecord/lib/active_record/attribute_methods/read.rb#L80

And the module is created by this:

https://github.com/rails/rails/blob/master/activerecord/lib/active_record/attribute_methods.rb#L56

I can't see any obvious way to make this work as is. There doesn't appear to be a way to access the model's class from inside the module.

rake db:create fails to generate spatial_ref_sys table

postgres info

SELECT version();
PostgreSQL 9.2.2 on x86_64-apple-darwin12.2.0, compiled by Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn), 64-bit

SELECT postgis_full_version();
POSTGIS="2.0.2 r10789" GEOS="3.3.6-CAPI-1.7.6" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.2, released 2012/10/08" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER

gem versions

ruby 1.9.3p374
rails (3.2.11)
pg (0.14.1)
activerecord-postgis-adapter (0.5.1)
rgeo (0.3.20)
rgeo-activerecord (0.4.6)

database.yml

development:
  adapter: postgis
  encoding: unicode
  database: geo_api_development
  pool: 5
  username: geo_api
  password: u_password
  su_username: postgres
  su_password: su_password
  schema_search_path: "public,postgis,topology"
  postgis_extension: "postgis,postgis_topology"

details

rake db:create correctly generates the postgis and postgis_topology database extensions but does not generate the spatial_ref_sys table.

Replacing postgis_extension: "postgis,postgis_topology" with script_dir: /usr/local/share/postgis (the script location when postgis is installed using homebrew) actually fails completely --- no postgis extensions are installed. The scripts directory contains all the usual postgis scripts: postgis.sql, topology.sql, spatial_ref_sys.sql etc.

Running CREATE EXTENSION postgis; and CREATE EXTENSION postgis_topology; on the database directly with psql correctly generates the extensions and the spatial_ref_sys table.

Note that this is not a full-stack rails application โ€” it was generated using the rails-api gem, which creates an app that includes only those modules necessary for creating an api service. If activerecord-postgis-adapter depends on any modules that aren't included in this reduced stack then it fails to generate any warnings or errors indicating so.

If you need any more info, let me know.

Rails 4 rake db:gis:setup crashes

$ bundle exec rake db:gis:setup --trace
** Invoke db:gis:setup (first_time)
rake aborted!
Don't know how to build task 'rails_env'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task_manager.rb:49:in `[]'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:60:in `lookup_prerequisite'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:56:in `block in prerequisite_tasks'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:56:in `collect'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:56:in `prerequisite_tasks'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
~/.rvm/rubies/ruby-2.0.0-p0-perf/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/gems/rake-10.0.4/bin/rake:33:in `'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bin/rake:23:in `load'
~/.rvm/gems/ruby-2.0.0-p0-perf@cta/bin/rake:23:in `'
Tasks: TOP => db:gis:setup

Postgres Error when using Guard

Hello,

I'm using guard to run my test suite but I get the following error since I added the gem and installed PostGIS, I get the following error.

Exception encountered: #<ActiveRecord::StatementInvalid: PG::Error: ERROR: must be owner of relation spatial_ref_sys: ALTER TABLE "spatial_ref_sys" ENABLE TRIGGER ALL>

I'm not sure if it related to your gem but I prefer to report it to you.

jruby on rails 4 support

Hi Daniel,

now that rails 4 is finalized, I was wondering whether you are still planning to add jruby on rails 4 support? It would be great to update our app to rails 4 and this is the only puzzle piece left ;)

Let me know if I can help you somehow!

Best,

rake db:rollback hangs

The following simple migration works with rake db:migrate, but calling rake db:rollback causes the ruby process to hang, eating CPU cycles.

class CreateCheckins < ActiveRecord::Migration
  def self.up
    create_table :checkins do |t|
      t.string :name
      t.point :latlon, :srid => 4326
      t.timestamps
    end
    add_index :checkins, :latlon, :spatial => true
  end

  def self.down
    remove_index :checkins, :latlon
    drop_table :checkins
  end
end

The rake tasks prints out
== CreateCheckins: reverting =================================================
-- remove_index(:checkins, :latlon)
-> 0.0031s
-- drop_table(:checkins)
-> 0.0017s
== CreateCheckins: reverted (0.0049s) ========================================
before it hangs, but looking at the database, the table and the index still exist.

When I change the adapter from postgis to postgresql, the rollback works.

Versions:
activerecord-postgis-adapter (0.2.3)
rgeo-activerecord (0.2.3)
rgeo (0.2.4)

undefined method `terminal' for class `Are::Visitors::DepthFirst'

rake db:schema:dump throws this exception:

undefined method `terminal' for class `Arel::Visitors::DepthFirst'
/usr/lib/ruby/gems/1.8/gems/rgeo-activerecord-0.2.2/lib/rgeo/active_record/arel_modifications.rb:90
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/rgeo-activerecord-0.2.2/lib/rgeo/active_record.rb:65
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activerecord-postgis-adapter-0.2.3/lib/active_record/connection_adapters/postgis_adapter.rb:37
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:69:in `establish_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/railtie.rb:59
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:1891
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:327
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:326:in `open'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:326
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

gem versions:

rake (0.8.7) 
abstract (1.0.0) 
activesupport (3.0.3) 
builder (2.1.2) 
i18n (0.4.2) 
activemodel (3.0.3) 
erubis (2.6.6) 
rack (1.2.1) 
rack-mount (0.6.13) 
rack-test (0.5.6) 
tzinfo (0.3.23) 
actionpack (3.0.3) 
mime-types (1.16) 
polyglot (0.3.1) 
treetop (1.4.9) 
mail (2.2.10) 
actionmailer (3.0.3) 
arel (2.0.4) 
activerecord (3.0.3) 
pg (0.10.0) 
rgeo (0.2.4) 
rgeo-activerecord (0.2.2) 
activerecord-postgis-adapter (0.2.3) 
activeresource (3.0.3) 
bundler (1.0.7) 
highline (1.6.1) 
net-ssh (2.0.23) 
net-scp (1.0.4) 
net-sftp (2.0.5) 
net-ssh-gateway (1.0.1) 
capistrano (2.5.19) 
cgi_multipart_eof_fix (2.5.0) 
daemons (1.1.0) 
fastthread (1.0.7) 
gem_plugin (0.2.3) 
mongrel (1.1.5) 
thor (0.14.6) 
railties (3.0.3) 
rails (3.0.3) 

unable to run rake db:create on lion

Hey,

I'm getting an error whenever I try and create the DB's on a new install on lion (ruby 1.9.3, pg 9.1.3, postgis 2.0). I've followed all the steps in your tutorial and build proj and geos correctly - all installed using brew, but, after this worked on my work machine, this is now not working on my home machine. It creates the db's, but it doesn't load the second part of the rake task where it creates the spacial features.

This is the error: "PG::Error: ERROR: could not access file "$libdir/postgis-2.0": No such file or directory"

I've been tearing my hair out looking at paths and such, so any help would be much appreciated.

Thanks,
Chris

postgis_template alternative

I use a quite simple alternative to your proposed options for: Dealing With PostGIS Definitions

I set up a template database once that already has the definitions in it; and never need to worry about it again as Rails allows you to specify a different template in the database.yml
template: template_postgis

For example, in my current server my notes were.


sudo su postgres

createdb template_postgis
createlang plpgsql template_postgis
psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis_comments.sql

psql template_postgis
-- in a production environment you may want to 
-- give role based permissions, but granting all for now
GRANT ALL ON geometry_columns TO PUBLIC;
GRANT ALL ON spatial_ref_sys TO PUBLIC;
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';

-- vacuum freeze: it will guarantee that all rows in the database are
-- "frozen" and will not be subject to transaction ID wraparound
-- problems.
VACUUM FREEZE;

When installing postgis on Windows, the installation sets up a template database called postgis also.

Is there any benefit to the (what I perceive as more complicated) method suggested?

Need postgis 2.0 to have extension in postgresql 9.1?

I use a debian wheezy with postgresql 9.1 and postgis 1.5.3-2. When I create database with activerecord-postgis-adapter that fails. Because i havn't got "/usr/share/postgresql/9.1/extension/postgis.control" file and I need it when it use "CREATE EXTENSION postgis SCHEMA postgis". Do I need absolutely postgis 2.0 to create extensions in postgresql extension folder? Or could I generate it with postgis 1.5.3?

Geometry Columns does not exist

I have followed your talk from railsconf 2012 and I am running into a few errors when trying to implement the second example on looking up timezones based on a location. The details of my setup are as follows: I am running Postgresql using Postgres.app which gives me version 9.1.3 of Postgres and 2.0.0 of PostGIS. I run into a few issues with the database.yml file, and running migrations. ( I have added the relevant gems and required their info in application.rb)

My database.yml file looks like this:

 development:
   adapter: postgis
   postgis_extension: true
   host: localhost
   encoding: unicode
   database: my_app_development
   pool: 5
   username: my_app
   password:

If I add the following line schema_search_path: "public,postgis" I get:

 rake aborted!
 PG::Error: ERROR:  schema "postgis" does not exist
 : SET search_path TO public,postgis

If I remove that line I receive the following error when I try to migrate my database:

rake aborted!
PG::Error: ERROR:  relation "geometry_columns" does not exist
LINE 1: SELECT * FROM geometry_columns WHERE f_table_name='schema_mi...                       ^
: SELECT * FROM geometry_columns WHERE f_table_name='schema_migrations'

Do you have any idea how to fix these issues, or what is causing them to occur?

Compatibility with rails 3.1.0.rc4

Just wondering if it's too early to start trying to use this gem with Rails 3.1

Setting the adapter on my database.yml to postgresql everything works fine but setting it to postgis will give me errors.

I've tested it out with an empty project on the console and it crashes with the following.
Note that the User model has no spacial columns

ruby-1.9.2-p180 :001 >  User.inspect
(0.2ms)  SET search_path TO public
(1.5ms)  SELECT * FROM geometry_columns WHERE f_table_name='users'
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.map
from /Users/jneto/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/base.rb:834:in `inspect'
from (irb):1
from /Users/jneto/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands/console.rb:45:in `start'
from /Users/jneto/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands/console.rb:8:in `start'
from /Users/jneto/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc4/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

having issues createing the postgis_topology extension

database.yml

...
adapter: postgis
pool: 5
timeout: 5000
schema_search_path: public,postgis,topology
postgis_extension: postgis,postgis_topology

PG::Error: ERROR: extension "postgis_topology" must be installed in schema "topology"
: CREATE EXTENSION postgis_topology SCHEMA postgis
/Users/ilya/.rvm/gems/ruby-1.9.3-p286@doormates/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:654:in `async_exec'

Am I doing something wrong?

Thanks.

issues with rails3

Im using rails 3. Added this to my gemfile:

   gem 'rails', '3.0.3'
   gem 'pg'
   gem 'activerecord-postgis-adapter'

After running the bundle install command I get:

   Using pg (0.10.1) 
   Installing rgeo (0.2.4) with native extensions 
   Installing rgeo-activerecord (0.3.0) 
   Installing activerecord-postgis-adapter (0.3.0)

My database.yml looks like this:

   development:
   adapter: postgis
   database: blog_development
   encoding: unicode
   pool: 5
   username: miguel

And when running the rake db:create I got something like this:

(in /Users/miguel/Desktop/projects/blog)
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-postgis-adapter-0.3.0/lib/active_record/connection_adapters/postgis_adapter/main_adapter.rb:51: syntax error, unexpected ')'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in require' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:innew_constants_in'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-postgis-adapter-0.3.0/lib/active_record/connection_adapters/postgis_adapter.rb:96
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in require' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:innew_constants_in'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:69:in establish_connection' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-postgis-adapter-0.3.0/lib/active_record/connection_adapters/postgis_adapter/databases.rake:50:increate_database'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:33
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:636:in call' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:636:inexecute'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:631:in each' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:631:inexecute'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /Users/miguel/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/monitor.rb:242:insynchronize'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2029:in each' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2001:in run' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:1998:in run' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/bin/rake:31 /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19:inload'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19
Couldn't create database for {"encoding"=>"unicode", "username"=>"miguel", "adapter"=>"postgis", "database"=>"blog_test", "pool"=>5}
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-postgis-adapter-0.3.0/lib/active_record/connection_adapters/postgis_adapter/main_adapter.rb:51: syntax error, unexpected ')'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in require' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:innew_constants_in'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-postgis-adapter-0.3.0/lib/active_record/connection_adapters/postgis_adapter.rb:96
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in require' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:innew_constants_in'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in load_dependency' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:69:in establish_connection' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-postgis-adapter-0.3.0/lib/active_record/connection_adapters/postgis_adapter/databases.rake:50:increate_database'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@blog/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:35
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:636:in call' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:636:inexecute'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:631:in each' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:631:inexecute'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /Users/miguel/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/monitor.rb:242:insynchronize'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2029:in each' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2001:in run' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/lib/rake.rb:1998:in run' /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/gems/rake-0.8.7/bin/rake:31 /Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19:inload'
/Users/miguel/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19
Couldn't create database for {"encoding"=>"unicode", "username"=>"miguel", "adapter"=>"postgis", "database"=>"blog_development", "pool"=>5}

Unit Tests don't run

Rails 3.2.2

rake test fails with:

Errors running test:units! #<RuntimeError: Task not supported by 'postgis'>

I assume this is another issue related to the name of the adapter being postgis instead of postgresql. I understand why you named the adapter like that, and that the issue really lies with Rails, but maybe it would be easier to just adopt the postgresql name for now to avoid all these incompatibilities?

rake db:test:prepare

$ rake db:test:prepare --trace
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
Resolved collector.newrelic.com to 204.93.223.153
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
rake aborted!
Task not supported by 'postgis'
/Users/shoaib/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/railties/databases.rake:517:in `block (3 levels) in <top (required)>'
/Users/shoaib/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/Users/shoaib/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/Users/shoaib/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/Users/shoaib/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/Users/shoaib/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'

"geographic" isn't being preserved

Reproduction steps:

  1. create a rails app

  2. generate a Location model

  3. use the following in the migration:

    class CreateLocations < ActiveRecord::Migration
      def self.up
        create_table :locations do |t|
          t.string :name
          t.point :lonlat, :srid => 4326, :geographic => true
          t.timestamps
        end
      end
    
      def self.down
        drop_table :locations
      end
    end
    
  4. when you run db:migrate, a geographic lonlat column is created in the dev database:
    ALTER TABLE locations ADD COLUMN lonlat geography(Point,4326);

  5. however, when you run tests, this is what is created in the test database:
    ALTER TABLE postgis.locations ADD COLUMN lonlat postgis.geometry;

My guess is that it's the schema that is being generated:

    ActiveRecord::Schema.define(:version => 20110121231950) do

      create_table "locations", :force => true do |t|
        t.string   "name"
        t.geometry "lonlat",     :limit => 0
        t.datetime "created_at"
        t.datetime "updated_at"
      end

    end

which doesn't seem to preserve the fact that lonlat is "geographic"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.