nofxx-postgis_adapter 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +0 -1
- data/lib/postgis_adapter.rb +1 -1
- data/lib/postgis_functions.rb +3 -3
- data/postgis_adapter.gemspec +3 -3
- data/spec/db/schema_postgis.rb +6 -0
- data/spec/postgis_functions_spec.rb +6 -0
- metadata +2 -3
data/Manifest.txt
CHANGED
data/lib/postgis_adapter.rb
CHANGED
data/lib/postgis_functions.rb
CHANGED
@@ -42,11 +42,11 @@ module PostgisFunctions
|
|
42
42
|
def construct_geometric_sql(type,geoms,options)
|
43
43
|
|
44
44
|
tables = geoms.map do |t| {
|
45
|
-
:
|
45
|
+
:name => t.class.table_name,
|
46
46
|
:uid => unique_identifier,
|
47
47
|
:id => t[:id] }
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
# Implement a better way for options?
|
51
51
|
if options.instance_of? Hash
|
52
52
|
transform = options.delete(:transform)
|
@@ -56,7 +56,7 @@ module PostgisFunctions
|
|
56
56
|
fields = tables.map { |f| "#{f[:uid]}.#{get_column_name}" } # W1.geom
|
57
57
|
fields.map! { |f| "ST_Transform(#{f}, #{transform})" } if transform # ST_Transform(W1.geom,x)
|
58
58
|
conditions = tables.map { |f| "#{f[:uid]}.id = #{f[:id]}" } # W1.id = 5
|
59
|
-
tables.map! { |f| "#{f[:
|
59
|
+
tables.map! { |f| "#{f[:name]} #{f[:uid]}" } # streets W1
|
60
60
|
|
61
61
|
#
|
62
62
|
# Data => SELECT Func(A,B)
|
data/postgis_adapter.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
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.1"
|
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-03-
|
9
|
+
s.date = %q{2009-03-10}
|
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"]
|
13
|
-
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "init.rb", "install.rb", "lib/postgis_adapter.rb", "lib/postgis_adapter/acts_as_geom.rb", "lib/postgis_adapter/
|
13
|
+
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "init.rb", "install.rb", "lib/postgis_adapter.rb", "lib/postgis_adapter/acts_as_geom.rb", "lib/postgis_adapter/common_spatial_adapter.rb", "lib/postgis_functions.rb", "lib/postgis_functions/bbox.rb", "lib/postgis_functions/class.rb", "lib/postgis_functions/common.rb", "postgis_adapter.gemspec", "rails/init.rb", "script/console", "script/destroy", "script/generate", "spec/db/database_postgis.yml", "spec/db/models_postgis.rb", "spec/db/schema_postgis.rb", "spec/postgis_adapter/acts_as_geom_spec.rb", "spec/postgis_adapter/common_spatial_adapter_spec.rb", "spec/postgis_adapter_spec.rb", "spec/postgis_functions/bbox_spec.rb", "spec/postgis_functions/class_spec.rb", "spec/postgis_functions/common_spec.rb", "spec/postgis_functions_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "uninstall.rb"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://github.com/nofxx/postgis_adapter}
|
16
16
|
s.rdoc_options = ["--main", "README.rdoc"]
|
data/spec/db/schema_postgis.rb
CHANGED
@@ -6,6 +6,7 @@ describe "PostgisFunctions" do
|
|
6
6
|
@c1 ||= City.create!(:data => "City1", :geom => Polygon.from_coordinates([[[12,45],[45,42],[4,1],[12,45]],[[2,5],[5,1],[14,1],[2,5]]],4326))
|
7
7
|
@s1 ||= Street.create!(:data => "Street1", :geom => LineString.from_coordinates([[-43,-20],[-42,-28]],4326))
|
8
8
|
@p1 ||= Position.create!(:data => "Point1", :geom => Point.from_x_y(-43,-22,4326))
|
9
|
+
@cg ||= CommonGeo.create!(:data => "Point1", :geom => Point.from_x_y(-43,-22,4326))
|
9
10
|
end
|
10
11
|
|
11
12
|
describe "Common Mix" do
|
@@ -14,6 +15,11 @@ describe "PostgisFunctions" do
|
|
14
15
|
@p1.distance_to(@s1).should be_close(0.248069469178417, 0.00000001)
|
15
16
|
end
|
16
17
|
|
18
|
+
it "should calculate distance point to line" do
|
19
|
+
@cg.distance_to(@s1).should be_close(0.248069469178417, 0.00000001)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
17
23
|
it "should calculate inside a city" do
|
18
24
|
@p1.should_not be_inside(@c1)
|
19
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nofxx-postgis_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
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-03-
|
12
|
+
date: 2009-03-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- install.rb
|
64
64
|
- lib/postgis_adapter.rb
|
65
65
|
- lib/postgis_adapter/acts_as_geom.rb
|
66
|
-
- lib/postgis_adapter/acts_as_geom_flymake.rb
|
67
66
|
- lib/postgis_adapter/common_spatial_adapter.rb
|
68
67
|
- lib/postgis_functions.rb
|
69
68
|
- lib/postgis_functions/bbox.rb
|