postgis_adapter 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
data/lib/postgis_adapter.rb
CHANGED
@@ -684,13 +684,6 @@ module PostgisFunctions
|
|
684
684
|
#
|
685
685
|
module PointFunctions
|
686
686
|
|
687
|
-
#
|
688
|
-
# Some nice getters
|
689
|
-
#
|
690
|
-
def x; @x ||= self[get_column_name].x; end
|
691
|
-
def y; @y ||= self[get_column_name].y; end
|
692
|
-
def z; @z ||= self[get_column_name].z; end
|
693
|
-
|
694
687
|
#
|
695
688
|
# Returns a float between 0 and 1 representing the location of the closest point
|
696
689
|
# on LineString to the given Point, as a fraction of total 2d line length.
|
data/postgis_adapter.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{postgis_adapter}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Marcos Piccinini"]
|
9
|
-
s.date = %q{2009-04-
|
9
|
+
s.date = %q{2009-04-14}
|
10
10
|
s.description = %q{Postgis Adapter for Activer Record}
|
11
11
|
s.email = ["x@nofxx.com"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
@@ -2,9 +2,11 @@ require File.dirname(__FILE__) + '/../spec_helper.rb'
|
|
2
2
|
|
3
3
|
describe "Class Functions" do
|
4
4
|
before(:all) do
|
5
|
-
@c1 ||= City.create!(:data => "
|
6
|
-
@s1 ||= Street.create!(:data => "
|
7
|
-
@
|
5
|
+
@c1 ||= City.create!(:data => "CityClass", :geom => Polygon.from_coordinates([[[12,45],[45,41],[4,1],[12,45]],[[2,5],[5,1],[14,1],[2,5]]],4326))
|
6
|
+
@s1 ||= Street.create!(:data => "StreetClass", :geom => LineString.from_coordinates([[1,1],[99,88]],4326))
|
7
|
+
@s2 ||= Street.create!(:data => "StreetClassTiny", :geom => LineString.from_coordinates([[1,1],[1.1,1.1]],4326))
|
8
|
+
@p1 ||= Position.create!(:data => "PointClass", :geom => Point.from_x_y(99,99,4326))
|
9
|
+
@p2 ||= Position.create!(:data => "PointClassClose", :geom => Point.from_x_y(99.9,99.9,4326))
|
8
10
|
end
|
9
11
|
|
10
12
|
it "should find the closest other point" do
|
@@ -19,6 +21,15 @@ describe "Class Functions" do
|
|
19
21
|
Position.closest_to(@p1.geom).data.should == @p1.data
|
20
22
|
end
|
21
23
|
|
24
|
+
it "should sort by size" do
|
25
|
+
Street.by_length.first.data.should == "StreetClassTiny"
|
26
|
+
Street.by_length.last.data.should == "StreetClass"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "largest" do
|
30
|
+
Street.longest.data.should == "StreetClass"
|
31
|
+
end
|
32
|
+
|
22
33
|
it "should sort by linestring length" do
|
23
34
|
Street.by_length.should be_instance_of(Array)
|
24
35
|
end
|
@@ -84,9 +84,9 @@ describe "Common Functions" do
|
|
84
84
|
lambda { @p2.to_utm! }.should change(@p2, :srid)
|
85
85
|
end
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
# it { @p3.x.should be_close(8.0, 0.1) }
|
88
|
+
# it { @p3.y.should be_close(8.0, 0.1) }
|
89
|
+
# it { @p3.z.should be_close(0.0, 0.1) }
|
90
90
|
|
91
91
|
end
|
92
92
|
|
@@ -185,15 +185,6 @@ describe "Common Functions" do
|
|
185
185
|
|
186
186
|
describe "LineString" do
|
187
187
|
|
188
|
-
it "should sort by size" do
|
189
|
-
Street.by_length.first.data.should == "Street1"
|
190
|
-
Street.by_length.last.data.should == "Street3"
|
191
|
-
end
|
192
|
-
|
193
|
-
it "largest" do
|
194
|
-
Street.longest.data.should == "Street3"
|
195
|
-
end
|
196
|
-
|
197
188
|
describe "Length" do
|
198
189
|
it { @s1.length.should be_close(1.4142135623731, 0.000001) }
|
199
190
|
it { @s2.length.should be_close(4.2, 0.1) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgis_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-14 00:00:00 -03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|