nofxx-postgis_adapter 0.5.6 → 0.5.7

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.6
1
+ 0.5.7
@@ -438,7 +438,7 @@ module PostgisFunctions
438
438
  # Return Geometry ST_Transform(geometry g1, integer srid);
439
439
  #
440
440
  def transform!(new_srid)
441
- self[geo_columns.first] = postgis_calculate("Transform", self, new_srid)
441
+ self[geo_columns.first] = postgis_calculate("Transform", self.new_record? ? self.geom : self, new_srid)
442
442
  end
443
443
 
444
444
  def transform(new_srid)
@@ -75,10 +75,10 @@ module PostgisFunctions
75
75
  fields = fields.join(" #{options} ")
76
76
  end
77
77
 
78
- sql = "SELECT #{opcode}(#{fields}) "
79
- sql << "FROM #{tables.join(",")} " if tables
80
- sql << "WHERE #{conditions.join(" AND ")}" if conditions
81
- #p sql; sql
78
+ sql = "SELECT #{opcode}(#{fields}) "
79
+ sql << "FROM #{tables.join(",")} " unless tables.empty?
80
+ sql << "WHERE #{conditions.join(" AND ")}" unless conditions.empty?
81
+ sql
82
82
  end
83
83
 
84
84
  #
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{postgis_adapter}
5
- s.version = "0.5.6"
8
+ s.version = "0.5.7"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Marcos Augusto"]
9
- s.date = %q{2009-07-22}
12
+ s.date = %q{2009-08-14}
10
13
  s.description = %q{Execute PostGIS functions on Active Record}
11
14
  s.email = %q{x@nofxx.com}
12
15
  s.extra_rdoc_files = [
@@ -45,7 +48,7 @@ Gem::Specification.new do |s|
45
48
  s.rdoc_options = ["--charset=UTF-8"]
46
49
  s.require_paths = ["lib"]
47
50
  s.rubyforge_project = %q{postgis_adapter}
48
- s.rubygems_version = %q{1.3.4}
51
+ s.rubygems_version = %q{1.3.5}
49
52
  s.summary = %q{PostGIS Adapter for Active Record}
50
53
  s.test_files = [
51
54
  "spec/db/models_postgis.rb",
@@ -11,7 +11,7 @@ end
11
11
  describe "ActsAsGeom" do
12
12
 
13
13
  it "should get the geom type" do
14
- p City.connection.columns("cities").select { |c| c.name == "geom" }[0]
14
+ City.connection.columns("cities").select { |c| c.name == "geom" }[0]
15
15
  City.get_geom_type(:geom).should eql(:polygon)
16
16
  end
17
17
 
@@ -69,6 +69,14 @@ describe "Common Functions" do
69
69
  @p1.geom.srid.should eql(29101)
70
70
  end
71
71
 
72
+ it "should transform non saved srid geoms" do
73
+ pt = Point.from_x_y(11121381.4586196,10161852.0494475, 29101)
74
+ pos = Position.new(:geom => pt)
75
+ pos.transform(4326)
76
+ pos.geom.x.should be_close(1.00000000000005, 0.00001)
77
+ pos.geom.y.should be_close(1.00000000000005, 0.00001)
78
+ end
79
+
72
80
  it "should see in what fraction of the ls it is" do
73
81
  @p1.where_on_line(@s1).should eql(0.0)
74
82
  end
@@ -317,6 +325,15 @@ describe "Common Functions" do
317
325
  @s2.utm_zone.should eql(32732)
318
326
  end
319
327
 
328
+ it "should transform non saved" do
329
+ ls = LineString.from_coordinates([[11435579.3992231,10669620.8116516],[11721337.4281638,11210714.9524106]],29101)
330
+ str = Street.new(:geom => ls)
331
+ str.transform(4326)
332
+ str.geom[0].x.should be_close(4,0.0000001)
333
+ str.geom[0].y.should be_close(4,0.0000001)
334
+ str.geom[1].x.should be_close(7,0.0000001)
335
+ str.geom[1].y.should be_close(7,0.0000001)
336
+ end
320
337
  end
321
338
 
322
339
  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.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Augusto
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-22 00:00:00 -07:00
12
+ date: 2009-08-14 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -51,6 +51,7 @@ files:
51
51
  - spec/spec_helper.rb
52
52
  has_rdoc: false
53
53
  homepage: http://github.com/nofxx/postgis_adapter
54
+ licenses:
54
55
  post_install_message:
55
56
  rdoc_options:
56
57
  - --charset=UTF-8
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
72
  requirements: []
72
73
 
73
74
  rubyforge_project: postgis_adapter
74
- rubygems_version: 1.2.0
75
+ rubygems_version: 1.3.5
75
76
  signing_key:
76
77
  specification_version: 3
77
78
  summary: PostGIS Adapter for Active Record