activerecord-postgis-adapter 0.4.0 → 0.4.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/History.rdoc +5 -0
 - data/README.rdoc +4 -4
 - data/Version +1 -1
 - data/lib/active_record/connection_adapters/postgis_adapter.rb +25 -25
 - data/lib/active_record/connection_adapters/postgis_adapter/arel_tosql.rb +15 -15
 - data/lib/active_record/connection_adapters/postgis_adapter/databases.rake +11 -11
 - data/lib/active_record/connection_adapters/postgis_adapter/main_adapter.rb +70 -61
 - data/lib/active_record/connection_adapters/postgis_adapter/railtie.rb +17 -17
 - data/lib/active_record/connection_adapters/postgis_adapter/spatial_column.rb +44 -39
 - data/lib/active_record/connection_adapters/postgis_adapter/spatial_table_definition.rb +33 -33
 - data/lib/active_record/connection_adapters/postgis_adapter/version.rb +16 -16
 - data/lib/rgeo/active_record/postgis_adapter/railtie.rb +7 -7
 - data/test/tc_basic.rb +38 -38
 - data/test/tc_ddl.rb +46 -46
 - data/test/tc_spatial_queries.rb +32 -32
 - metadata +36 -40
 
    
        data/test/tc_basic.rb
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # -----------------------------------------------------------------------------
         
     | 
| 
       2 
     | 
    
         
            -
            # 
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            # Tests for the PostGIS ActiveRecord adapter
         
     | 
| 
       4 
     | 
    
         
            -
            # 
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
       5 
5 
     | 
    
         
             
            # -----------------------------------------------------------------------------
         
     | 
| 
       6 
     | 
    
         
            -
            # Copyright 2010 Daniel Azuma
         
     | 
| 
       7 
     | 
    
         
            -
            # 
     | 
| 
      
 6 
     | 
    
         
            +
            # Copyright 2010-2012 Daniel Azuma
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
       8 
8 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       9 
     | 
    
         
            -
            # 
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
       10 
10 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without
         
     | 
| 
       11 
11 
     | 
    
         
             
            # modification, are permitted provided that the following conditions are met:
         
     | 
| 
       12 
     | 
    
         
            -
            # 
     | 
| 
      
 12 
     | 
    
         
            +
            #
         
     | 
| 
       13 
13 
     | 
    
         
             
            # * Redistributions of source code must retain the above copyright notice,
         
     | 
| 
       14 
14 
     | 
    
         
             
            #   this list of conditions and the following disclaimer.
         
     | 
| 
       15 
15 
     | 
    
         
             
            # * Redistributions in binary form must reproduce the above copyright notice,
         
     | 
| 
         @@ -18,7 +18,7 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
            # * Neither the name of the copyright holder, nor the names of any other
         
     | 
| 
       19 
19 
     | 
    
         
             
            #   contributors to this software, may be used to endorse or promote products
         
     | 
| 
       20 
20 
     | 
    
         
             
            #   derived from this software without specific prior written permission.
         
     | 
| 
       21 
     | 
    
         
            -
            # 
     | 
| 
      
 21 
     | 
    
         
            +
            #
         
     | 
| 
       22 
22 
     | 
    
         
             
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         
     | 
| 
       23 
23 
     | 
    
         
             
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         
     | 
| 
       24 
24 
     | 
    
         
             
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         
     | 
| 
         @@ -41,15 +41,15 @@ module RGeo 
     | 
|
| 
       41 
41 
     | 
    
         
             
              module ActiveRecord  # :nodoc:
         
     | 
| 
       42 
42 
     | 
    
         
             
                module PostGISAdapter  # :nodoc:
         
     | 
| 
       43 
43 
     | 
    
         
             
                  module Tests  # :nodoc:
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       45 
45 
     | 
    
         
             
                    class TestBasic < ::Test::Unit::TestCase  # :nodoc:
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       47 
47 
     | 
    
         
             
                      DATABASE_CONFIG_PATH = ::File.dirname(__FILE__)+'/database.yml'
         
     | 
| 
       48 
48 
     | 
    
         
             
                      include AdapterTestHelper
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       50 
50 
     | 
    
         
             
                      define_test_methods do
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       53 
53 
     | 
    
         
             
                        def populate_ar_class(content_)
         
     | 
| 
       54 
54 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       55 
55 
     | 
    
         
             
                          case content_
         
     | 
| 
         @@ -68,20 +68,20 @@ module RGeo 
     | 
|
| 
       68 
68 
     | 
    
         
             
                          end
         
     | 
| 
       69 
69 
     | 
    
         
             
                          klass_
         
     | 
| 
       70 
70 
     | 
    
         
             
                        end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       73 
73 
     | 
    
         
             
                        def test_version
         
     | 
| 
       74 
74 
     | 
    
         
             
                          assert_not_nil(::ActiveRecord::ConnectionAdapters::PostGISAdapter::VERSION)
         
     | 
| 
       75 
75 
     | 
    
         
             
                        end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
       78 
78 
     | 
    
         
             
                        def test_postgis_available
         
     | 
| 
       79 
79 
     | 
    
         
             
                          connection_ = create_ar_class.connection
         
     | 
| 
       80 
80 
     | 
    
         
             
                          assert_equal('PostGIS', connection_.adapter_name)
         
     | 
| 
       81 
81 
     | 
    
         
             
                          assert_not_nil(connection_.postgis_lib_version)
         
     | 
| 
       82 
82 
     | 
    
         
             
                        end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
       85 
85 
     | 
    
         
             
                        def test_set_and_get_point
         
     | 
| 
       86 
86 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       87 
87 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -90,8 +90,8 @@ module RGeo 
     | 
|
| 
       90 
90 
     | 
    
         
             
                          assert_equal(@factory.point(1, 2), obj_.latlon)
         
     | 
| 
       91 
91 
     | 
    
         
             
                          assert_equal(3785, obj_.latlon.srid)
         
     | 
| 
       92 
92 
     | 
    
         
             
                        end
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
       95 
95 
     | 
    
         
             
                        def test_set_and_get_point_from_wkt
         
     | 
| 
       96 
96 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       97 
97 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -100,8 +100,8 @@ module RGeo 
     | 
|
| 
       100 
100 
     | 
    
         
             
                          assert_equal(@factory.point(1, 2), obj_.latlon)
         
     | 
| 
       101 
101 
     | 
    
         
             
                          assert_equal(3785, obj_.latlon.srid)
         
     | 
| 
       102 
102 
     | 
    
         
             
                        end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
       105 
105 
     | 
    
         
             
                        def test_save_and_load_point
         
     | 
| 
       106 
106 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       107 
107 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -113,8 +113,8 @@ module RGeo 
     | 
|
| 
       113 
113 
     | 
    
         
             
                          assert_equal(3785, obj2_.latlon.srid)
         
     | 
| 
       114 
114 
     | 
    
         
             
                          assert_equal(true, ::RGeo::Geos.is_geos?(obj2_.latlon))
         
     | 
| 
       115 
115 
     | 
    
         
             
                        end
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
       118 
118 
     | 
    
         
             
                        def test_save_and_load_geographic_point
         
     | 
| 
       119 
119 
     | 
    
         
             
                          klass_ = populate_ar_class(:latlon_point_geographic)
         
     | 
| 
       120 
120 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -126,8 +126,8 @@ module RGeo 
     | 
|
| 
       126 
126 
     | 
    
         
             
                          assert_equal(4326, obj2_.latlon.srid)
         
     | 
| 
       127 
127 
     | 
    
         
             
                          assert_equal(false, ::RGeo::Geos.is_geos?(obj2_.latlon))
         
     | 
| 
       128 
128 
     | 
    
         
             
                        end
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
       131 
131 
     | 
    
         
             
                        def test_save_and_load_point_from_wkt
         
     | 
| 
       132 
132 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       133 
133 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -138,15 +138,15 @@ module RGeo 
     | 
|
| 
       138 
138 
     | 
    
         
             
                          assert_equal(@factory.point(1, 2), obj2_.latlon)
         
     | 
| 
       139 
139 
     | 
    
         
             
                          assert_equal(3785, obj2_.latlon.srid)
         
     | 
| 
       140 
140 
     | 
    
         
             
                        end
         
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
       143 
143 
     | 
    
         
             
                        def test_set_point_bad_wkt
         
     | 
| 
       144 
144 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       145 
145 
     | 
    
         
             
                          obj_ = klass_.create(:latlon => 'POINT (x)')
         
     | 
| 
       146 
146 
     | 
    
         
             
                          assert_nil(obj_.latlon)
         
     | 
| 
       147 
147 
     | 
    
         
             
                        end
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
       150 
150 
     | 
    
         
             
                        def test_readme_example
         
     | 
| 
       151 
151 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       152 
152 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -168,8 +168,8 @@ module RGeo 
     | 
|
| 
       168 
168 
     | 
    
         
             
                          rec_.shape = loc_
         
     | 
| 
       169 
169 
     | 
    
         
             
                          assert_equal(true, ::RGeo::Geos.is_geos?(rec_.shape))
         
     | 
| 
       170 
170 
     | 
    
         
             
                        end
         
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
       173 
173 
     | 
    
         
             
                        def test_save_and_load_no_constraints
         
     | 
| 
       174 
174 
     | 
    
         
             
                          klass_ = populate_ar_class(:no_constraints)
         
     | 
| 
       175 
175 
     | 
    
         
             
                          factory1_ = ::RGeo::Cartesian.preferred_factory(:srid => 3785)
         
     | 
| 
         @@ -187,8 +187,8 @@ module RGeo 
     | 
|
| 
       187 
187 
     | 
    
         
             
                          assert_equal(factory2_.point(3,4), obj3_.geo)
         
     | 
| 
       188 
188 
     | 
    
         
             
                          assert_equal(2000, obj3_.geo.srid)
         
     | 
| 
       189 
189 
     | 
    
         
             
                        end
         
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
       192 
192 
     | 
    
         
             
                        def test_point_to_json
         
     | 
| 
       193 
193 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       194 
194 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -196,12 +196,12 @@ module RGeo 
     | 
|
| 
       196 
196 
     | 
    
         
             
                          obj_.latlon = @factory.point(1, 2)
         
     | 
| 
       197 
197 
     | 
    
         
             
                          assert_match(/"latlon":"POINT\s\(1\.0\s2\.0\)"/, obj_.to_json)
         
     | 
| 
       198 
198 
     | 
    
         
             
                        end
         
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
       201 
201 
     | 
    
         
             
                      end
         
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
       203 
203 
     | 
    
         
             
                    end
         
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
       205 
205 
     | 
    
         
             
                  end
         
     | 
| 
       206 
206 
     | 
    
         
             
                end
         
     | 
| 
       207 
207 
     | 
    
         
             
              end
         
     | 
    
        data/test/tc_ddl.rb
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # -----------------------------------------------------------------------------
         
     | 
| 
       2 
     | 
    
         
            -
            # 
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            # Tests for the PostGIS ActiveRecord adapter
         
     | 
| 
       4 
     | 
    
         
            -
            # 
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
       5 
5 
     | 
    
         
             
            # -----------------------------------------------------------------------------
         
     | 
| 
       6 
     | 
    
         
            -
            # Copyright 2010 Daniel Azuma
         
     | 
| 
       7 
     | 
    
         
            -
            # 
     | 
| 
      
 6 
     | 
    
         
            +
            # Copyright 2010-2012 Daniel Azuma
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
       8 
8 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       9 
     | 
    
         
            -
            # 
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
       10 
10 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without
         
     | 
| 
       11 
11 
     | 
    
         
             
            # modification, are permitted provided that the following conditions are met:
         
     | 
| 
       12 
     | 
    
         
            -
            # 
     | 
| 
      
 12 
     | 
    
         
            +
            #
         
     | 
| 
       13 
13 
     | 
    
         
             
            # * Redistributions of source code must retain the above copyright notice,
         
     | 
| 
       14 
14 
     | 
    
         
             
            #   this list of conditions and the following disclaimer.
         
     | 
| 
       15 
15 
     | 
    
         
             
            # * Redistributions in binary form must reproduce the above copyright notice,
         
     | 
| 
         @@ -18,7 +18,7 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
            # * Neither the name of the copyright holder, nor the names of any other
         
     | 
| 
       19 
19 
     | 
    
         
             
            #   contributors to this software, may be used to endorse or promote products
         
     | 
| 
       20 
20 
     | 
    
         
             
            #   derived from this software without specific prior written permission.
         
     | 
| 
       21 
     | 
    
         
            -
            # 
     | 
| 
      
 21 
     | 
    
         
            +
            #
         
     | 
| 
       22 
22 
     | 
    
         
             
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         
     | 
| 
       23 
23 
     | 
    
         
             
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         
     | 
| 
       24 
24 
     | 
    
         
             
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         
     | 
| 
         @@ -41,15 +41,15 @@ module RGeo 
     | 
|
| 
       41 
41 
     | 
    
         
             
              module ActiveRecord  # :nodoc:
         
     | 
| 
       42 
42 
     | 
    
         
             
                module PostGISAdapter  # :nodoc:
         
     | 
| 
       43 
43 
     | 
    
         
             
                  module Tests  # :nodoc:
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       45 
45 
     | 
    
         
             
                    class TestDDL < ::Test::Unit::TestCase  # :nodoc:
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       47 
47 
     | 
    
         
             
                      DATABASE_CONFIG_PATH = ::File.dirname(__FILE__)+'/database.yml'
         
     | 
| 
       48 
48 
     | 
    
         
             
                      include AdapterTestHelper
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       50 
50 
     | 
    
         
             
                      define_test_methods do
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       53 
53 
     | 
    
         
             
                        def test_create_simple_geometry
         
     | 
| 
       54 
54 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       55 
55 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -65,8 +65,8 @@ module RGeo 
     | 
|
| 
       65 
65 
     | 
    
         
             
                          klass_.connection.drop_table(:spatial_test)
         
     | 
| 
       66 
66 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       67 
67 
     | 
    
         
             
                        end
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
       70 
70 
     | 
    
         
             
                        def test_create_no_constraints_geometry
         
     | 
| 
       71 
71 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       72 
72 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -82,8 +82,8 @@ module RGeo 
     | 
|
| 
       82 
82 
     | 
    
         
             
                          klass_.connection.drop_table(:spatial_test)
         
     | 
| 
       83 
83 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       84 
84 
     | 
    
         
             
                        end
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
       87 
87 
     | 
    
         
             
                        def test_create_simple_geography
         
     | 
| 
       88 
88 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       89 
89 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -97,8 +97,8 @@ module RGeo 
     | 
|
| 
       97 
97 
     | 
    
         
             
                          assert(klass_.cached_attributes.include?('latlon'))
         
     | 
| 
       98 
98 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       99 
99 
     | 
    
         
             
                        end
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
       102 
102 
     | 
    
         
             
                        def test_create_point_geometry
         
     | 
| 
       103 
103 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       104 
104 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -107,8 +107,8 @@ module RGeo 
     | 
|
| 
       107 
107 
     | 
    
         
             
                          assert_equal(::RGeo::Feature::Point, klass_.columns.last.geometric_type)
         
     | 
| 
       108 
108 
     | 
    
         
             
                          assert(klass_.cached_attributes.include?('latlon'))
         
     | 
| 
       109 
109 
     | 
    
         
             
                        end
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
       112 
112 
     | 
    
         
             
                        def test_create_geometry_with_index
         
     | 
| 
       113 
113 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       114 
114 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -119,8 +119,8 @@ module RGeo 
     | 
|
| 
       119 
119 
     | 
    
         
             
                          end
         
     | 
| 
       120 
120 
     | 
    
         
             
                          assert(klass_.connection.indexes(:spatial_test).last.spatial)
         
     | 
| 
       121 
121 
     | 
    
         
             
                        end
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
       124 
124 
     | 
    
         
             
                        def test_add_geometry_column
         
     | 
| 
       125 
125 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       126 
126 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -142,8 +142,8 @@ module RGeo 
     | 
|
| 
       142 
142 
     | 
    
         
             
                          assert_nil(cols_[-1].geometric_type)
         
     | 
| 
       143 
143 
     | 
    
         
             
                          assert_equal(false, cols_[-1].has_spatial_constraints?)
         
     | 
| 
       144 
144 
     | 
    
         
             
                        end
         
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
       147 
147 
     | 
    
         
             
                        def test_add_no_constraints_geometry_column
         
     | 
| 
       148 
148 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       149 
149 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -165,8 +165,8 @@ module RGeo 
     | 
|
| 
       165 
165 
     | 
    
         
             
                          assert_nil(cols_[-1].geometric_type)
         
     | 
| 
       166 
166 
     | 
    
         
             
                          assert_equal(false, cols_[-1].has_spatial_constraints?)
         
     | 
| 
       167 
167 
     | 
    
         
             
                        end
         
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
       170 
170 
     | 
    
         
             
                        def test_add_geography_column
         
     | 
| 
       171 
171 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       172 
172 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -188,8 +188,8 @@ module RGeo 
     | 
|
| 
       188 
188 
     | 
    
         
             
                          assert_nil(cols_[-1].geometric_type)
         
     | 
| 
       189 
189 
     | 
    
         
             
                          assert_equal(false, cols_[-1].has_spatial_constraints?)
         
     | 
| 
       190 
190 
     | 
    
         
             
                        end
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
       193 
193 
     | 
    
         
             
                        def test_drop_geometry_column
         
     | 
| 
       194 
194 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       195 
195 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -206,8 +206,8 @@ module RGeo 
     | 
|
| 
       206 
206 
     | 
    
         
             
                          assert_equal(-1, cols_[-1].srid)
         
     | 
| 
       207 
207 
     | 
    
         
             
                          assert_equal(false, cols_[-1].geographic?)
         
     | 
| 
       208 
208 
     | 
    
         
             
                        end
         
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
      
 210 
     | 
    
         
            +
             
     | 
| 
       211 
211 
     | 
    
         
             
                        def test_drop_geography_column
         
     | 
| 
       212 
212 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       213 
213 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -227,8 +227,8 @@ module RGeo 
     | 
|
| 
       227 
227 
     | 
    
         
             
                          assert_equal('latlon', cols_[-2].name)
         
     | 
| 
       228 
228 
     | 
    
         
             
                          assert_equal(false, cols_[-2].geographic?)
         
     | 
| 
       229 
229 
     | 
    
         
             
                        end
         
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
      
 230 
     | 
    
         
            +
             
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
       232 
232 
     | 
    
         
             
                        def test_create_simple_geometry_using_shortcut
         
     | 
| 
       233 
233 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       234 
234 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -243,8 +243,8 @@ module RGeo 
     | 
|
| 
       243 
243 
     | 
    
         
             
                          klass_.connection.drop_table(:spatial_test)
         
     | 
| 
       244 
244 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       245 
245 
     | 
    
         
             
                        end
         
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
     | 
    
         
            -
             
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
       248 
248 
     | 
    
         
             
                        def test_create_no_constraints_geometry_using_shortcut
         
     | 
| 
       249 
249 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       250 
250 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -259,8 +259,8 @@ module RGeo 
     | 
|
| 
       259 
259 
     | 
    
         
             
                          klass_.connection.drop_table(:spatial_test)
         
     | 
| 
       260 
260 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       261 
261 
     | 
    
         
             
                        end
         
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
       264 
264 
     | 
    
         
             
                        def test_create_simple_geography_using_shortcut
         
     | 
| 
       265 
265 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       266 
266 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -274,8 +274,8 @@ module RGeo 
     | 
|
| 
       274 
274 
     | 
    
         
             
                          assert(klass_.cached_attributes.include?('latlon'))
         
     | 
| 
       275 
275 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       276 
276 
     | 
    
         
             
                        end
         
     | 
| 
       277 
     | 
    
         
            -
             
     | 
| 
       278 
     | 
    
         
            -
             
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
       279 
279 
     | 
    
         
             
                        def test_create_point_geometry_using_shortcut
         
     | 
| 
       280 
280 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       281 
281 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -284,8 +284,8 @@ module RGeo 
     | 
|
| 
       284 
284 
     | 
    
         
             
                          assert_equal(::RGeo::Feature::Point, klass_.columns.last.geometric_type)
         
     | 
| 
       285 
285 
     | 
    
         
             
                          assert(klass_.cached_attributes.include?('latlon'))
         
     | 
| 
       286 
286 
     | 
    
         
             
                        end
         
     | 
| 
       287 
     | 
    
         
            -
             
     | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
      
 287 
     | 
    
         
            +
             
     | 
| 
      
 288 
     | 
    
         
            +
             
     | 
| 
       289 
289 
     | 
    
         
             
                        def test_create_geometry_with_options
         
     | 
| 
       290 
290 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       291 
291 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -303,8 +303,8 @@ module RGeo 
     | 
|
| 
       303 
303 
     | 
    
         
             
                          klass_.connection.drop_table(:spatial_test)
         
     | 
| 
       304 
304 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       305 
305 
     | 
    
         
             
                        end
         
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
      
 306 
     | 
    
         
            +
             
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
       308 
308 
     | 
    
         
             
                        def test_create_geometry_using_limit
         
     | 
| 
       309 
309 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       310 
310 
     | 
    
         
             
                          klass_.connection.create_table(:spatial_test) do |t_|
         
     | 
| 
         @@ -322,12 +322,12 @@ module RGeo 
     | 
|
| 
       322 
322 
     | 
    
         
             
                          klass_.connection.drop_table(:spatial_test)
         
     | 
| 
       323 
323 
     | 
    
         
             
                          assert_equal(0, klass_.connection.select_value("SELECT COUNT(*) FROM geometry_columns WHERE f_table_name='spatial_test'").to_i)
         
     | 
| 
       324 
324 
     | 
    
         
             
                        end
         
     | 
| 
       325 
     | 
    
         
            -
             
     | 
| 
       326 
     | 
    
         
            -
             
     | 
| 
      
 325 
     | 
    
         
            +
             
     | 
| 
      
 326 
     | 
    
         
            +
             
     | 
| 
       327 
327 
     | 
    
         
             
                      end
         
     | 
| 
       328 
     | 
    
         
            -
             
     | 
| 
      
 328 
     | 
    
         
            +
             
     | 
| 
       329 
329 
     | 
    
         
             
                    end
         
     | 
| 
       330 
     | 
    
         
            -
             
     | 
| 
      
 330 
     | 
    
         
            +
             
     | 
| 
       331 
331 
     | 
    
         
             
                  end
         
     | 
| 
       332 
332 
     | 
    
         
             
                end
         
     | 
| 
       333 
333 
     | 
    
         
             
              end
         
     | 
    
        data/test/tc_spatial_queries.rb
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # -----------------------------------------------------------------------------
         
     | 
| 
       2 
     | 
    
         
            -
            # 
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
       3 
3 
     | 
    
         
             
            # Tests for the PostGIS ActiveRecord adapter
         
     | 
| 
       4 
     | 
    
         
            -
            # 
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
       5 
5 
     | 
    
         
             
            # -----------------------------------------------------------------------------
         
     | 
| 
       6 
     | 
    
         
            -
            # Copyright 2010 Daniel Azuma
         
     | 
| 
       7 
     | 
    
         
            -
            # 
     | 
| 
      
 6 
     | 
    
         
            +
            # Copyright 2010-2012 Daniel Azuma
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
       8 
8 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       9 
     | 
    
         
            -
            # 
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
       10 
10 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without
         
     | 
| 
       11 
11 
     | 
    
         
             
            # modification, are permitted provided that the following conditions are met:
         
     | 
| 
       12 
     | 
    
         
            -
            # 
     | 
| 
      
 12 
     | 
    
         
            +
            #
         
     | 
| 
       13 
13 
     | 
    
         
             
            # * Redistributions of source code must retain the above copyright notice,
         
     | 
| 
       14 
14 
     | 
    
         
             
            #   this list of conditions and the following disclaimer.
         
     | 
| 
       15 
15 
     | 
    
         
             
            # * Redistributions in binary form must reproduce the above copyright notice,
         
     | 
| 
         @@ -18,7 +18,7 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
            # * Neither the name of the copyright holder, nor the names of any other
         
     | 
| 
       19 
19 
     | 
    
         
             
            #   contributors to this software, may be used to endorse or promote products
         
     | 
| 
       20 
20 
     | 
    
         
             
            #   derived from this software without specific prior written permission.
         
     | 
| 
       21 
     | 
    
         
            -
            # 
     | 
| 
      
 21 
     | 
    
         
            +
            #
         
     | 
| 
       22 
22 
     | 
    
         
             
            # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         
     | 
| 
       23 
23 
     | 
    
         
             
            # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         
     | 
| 
       24 
24 
     | 
    
         
             
            # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         
     | 
| 
         @@ -41,15 +41,15 @@ module RGeo 
     | 
|
| 
       41 
41 
     | 
    
         
             
              module ActiveRecord  # :nodoc:
         
     | 
| 
       42 
42 
     | 
    
         
             
                module PostGISAdapter  # :nodoc:
         
     | 
| 
       43 
43 
     | 
    
         
             
                  module Tests  # :nodoc:
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       45 
45 
     | 
    
         
             
                    class TestSpatialQueries < ::Test::Unit::TestCase  # :nodoc:
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       47 
47 
     | 
    
         
             
                      DATABASE_CONFIG_PATH = ::File.dirname(__FILE__)+'/database.yml'
         
     | 
| 
       48 
48 
     | 
    
         
             
                      include AdapterTestHelper
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       50 
50 
     | 
    
         
             
                      define_test_methods do
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       53 
53 
     | 
    
         
             
                        def populate_ar_class(content_)
         
     | 
| 
       54 
54 
     | 
    
         
             
                          klass_ = create_ar_class
         
     | 
| 
       55 
55 
     | 
    
         
             
                          case content_
         
     | 
| 
         @@ -68,8 +68,8 @@ module RGeo 
     | 
|
| 
       68 
68 
     | 
    
         
             
                          end
         
     | 
| 
       69 
69 
     | 
    
         
             
                          klass_
         
     | 
| 
       70 
70 
     | 
    
         
             
                        end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       73 
73 
     | 
    
         
             
                        def test_query_point
         
     | 
| 
       74 
74 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       75 
75 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -81,8 +81,8 @@ module RGeo 
     | 
|
| 
       81 
81 
     | 
    
         
             
                          obj3_ = klass_.where(:latlon => @factory.point(2, 2)).first
         
     | 
| 
       82 
82 
     | 
    
         
             
                          assert_nil(obj3_)
         
     | 
| 
       83 
83 
     | 
    
         
             
                        end
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
       86 
86 
     | 
    
         
             
                        def test_query_point_wkt
         
     | 
| 
       87 
87 
     | 
    
         
             
                          klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       88 
88 
     | 
    
         
             
                          obj_ = klass_.new
         
     | 
| 
         @@ -94,11 +94,11 @@ module RGeo 
     | 
|
| 
       94 
94 
     | 
    
         
             
                          obj3_ = klass_.where(:latlon => 'SRID=3785;POINT(2 2)').first
         
     | 
| 
       95 
95 
     | 
    
         
             
                          assert_nil(obj3_)
         
     | 
| 
       96 
96 
     | 
    
         
             
                        end
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
       99 
99 
     | 
    
         
             
                        if ::RGeo::ActiveRecord.spatial_expressions_supported?
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
       102 
102 
     | 
    
         
             
                          def test_query_st_distance
         
     | 
| 
       103 
103 
     | 
    
         
             
                            klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       104 
104 
     | 
    
         
             
                            obj_ = klass_.new
         
     | 
| 
         @@ -110,8 +110,8 @@ module RGeo 
     | 
|
| 
       110 
110 
     | 
    
         
             
                            obj3_ = klass_.where(klass_.arel_table[:latlon].st_distance('SRID=3785;POINT(2 3)').gt(2)).first
         
     | 
| 
       111 
111 
     | 
    
         
             
                            assert_nil(obj3_)
         
     | 
| 
       112 
112 
     | 
    
         
             
                          end
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
       115 
115 
     | 
    
         
             
                          def test_query_st_distance_from_constant
         
     | 
| 
       116 
116 
     | 
    
         
             
                            klass_ = populate_ar_class(:mercator_point)
         
     | 
| 
       117 
117 
     | 
    
         
             
                            obj_ = klass_.new
         
     | 
| 
         @@ -123,8 +123,8 @@ module RGeo 
     | 
|
| 
       123 
123 
     | 
    
         
             
                            obj3_ = klass_.where(::Arel.spatial('SRID=3785;POINT(2 3)').st_distance(klass_.arel_table[:latlon]).gt(2)).first
         
     | 
| 
       124 
124 
     | 
    
         
             
                            assert_nil(obj3_)
         
     | 
| 
       125 
125 
     | 
    
         
             
                          end
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
       128 
128 
     | 
    
         
             
                          def test_query_st_length
         
     | 
| 
       129 
129 
     | 
    
         
             
                            klass_ = populate_ar_class(:path_linestring)
         
     | 
| 
       130 
130 
     | 
    
         
             
                            obj_ = klass_.new
         
     | 
| 
         @@ -136,19 +136,19 @@ module RGeo 
     | 
|
| 
       136 
136 
     | 
    
         
             
                            obj3_ = klass_.where(klass_.arel_table[:path].st_length.gt(3)).first
         
     | 
| 
       137 
137 
     | 
    
         
             
                            assert_nil(obj3_)
         
     | 
| 
       138 
138 
     | 
    
         
             
                          end
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
       141 
141 
     | 
    
         
             
                        else
         
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
       143 
143 
     | 
    
         
             
                          puts "WARNING: The current Arel does not support named functions. Spatial expression tests skipped."
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
       145 
145 
     | 
    
         
             
                        end
         
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
       148 
148 
     | 
    
         
             
                      end
         
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
       150 
150 
     | 
    
         
             
                    end
         
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
       152 
152 
     | 
    
         
             
                  end
         
     | 
| 
       153 
153 
     | 
    
         
             
                end
         
     | 
| 
       154 
154 
     | 
    
         
             
              end
         
     |