postgres_ext-postgis 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/lib/postgres_ext/postgis/active_record/connection_adapters.rb +2 -0
- data/lib/postgres_ext/postgis/active_record/connection_adapters/postgresql_adapter.rb +1 -0
- data/lib/postgres_ext/postgis/version.rb +1 -1
- data/test/type_casts/geometry_test.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e706507f13ca6fab29f8149ba2602cd7db3fa3b
|
4
|
+
data.tar.gz: f20e89d32e6c79ba09bfdbde445b8db66e99756b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d68faeddbd2314dc823d202b4f9b4cf3ad0ef6f3d9aae1f6ea17e99a5c06e406fd036ebf6f2e62c8f6040c2f3c3942ba07b874f6aa3ec10001b339305b7b72
|
7
|
+
data.tar.gz: 5d3b8aba42f5d1c530fd24e00f885e5ab029ef5082e030f9f7ee5bf8944a0aada39caa60bafa384be8ece64898b65065979ea57423b4291a33ef0c3a18d0d16a
|
data/Rakefile
CHANGED
@@ -89,6 +89,7 @@ module PostgresExt::Postgis::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
|
89
89
|
module OID
|
90
90
|
def self.prepended(klass)
|
91
91
|
klass.register_type 'geometry', OID::Geometry.new
|
92
|
+
klass.register_type 'geography', OID::Geometry.new
|
92
93
|
end
|
93
94
|
|
94
95
|
class Geometry < ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Type
|
@@ -36,3 +36,28 @@ SQL
|
|
36
36
|
place.location.srid.must_equal 1
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
describe 'geography casts' do
|
41
|
+
it 'converts WKB from PostgreSQL into RGeo objects' do
|
42
|
+
connection.execute <<-SQL
|
43
|
+
INSERT INTO places (location_2)
|
44
|
+
VALUES (ST_GeographyFromText('POINT(1 1)'));
|
45
|
+
SQL
|
46
|
+
place = Place.first
|
47
|
+
|
48
|
+
(RGeo::Feature::Point === place.location_2).must_equal true
|
49
|
+
place.location_2.x.must_equal 1
|
50
|
+
place.location_2.y.must_equal 1
|
51
|
+
place.location_2.srid.must_equal 4326
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'parses WKT attributes into RGeo objects' do
|
55
|
+
place = Place.new
|
56
|
+
|
57
|
+
place.location_2 = 'SRID=4623;POINT(1 1)'
|
58
|
+
(RGeo::Feature::Point === place.location_2).must_equal true
|
59
|
+
place.location_2.x.must_equal 1
|
60
|
+
place.location_2.y.must_equal 1
|
61
|
+
place.location_2.srid.must_equal 4623
|
62
|
+
end
|
63
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgres_ext-postgis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan McClain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: postgres_ext
|