rgeo 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/History.rdoc +11 -0
  2. data/README.rdoc +1 -1
  3. data/Spatial_Programming_With_RGeo.rdoc +382 -0
  4. data/Version +1 -1
  5. data/lib/active_record/connection_adapters/postgis_adapter.rb +1 -1
  6. data/lib/rgeo.rb +4 -4
  7. data/lib/rgeo/active_record/base_modifications.rb +1 -1
  8. data/lib/rgeo/all.rb +1 -1
  9. data/lib/rgeo/cartesian/bounding_box.rb +2 -2
  10. data/lib/rgeo/cartesian/factory.rb +18 -11
  11. data/lib/rgeo/cartesian/interface.rb +4 -4
  12. data/lib/rgeo/coord_sys.rb +8 -1
  13. data/lib/rgeo/coord_sys/proj4.rb +4 -4
  14. data/lib/rgeo/feature/factory.rb +68 -49
  15. data/lib/rgeo/feature/factory_generator.rb +2 -2
  16. data/lib/rgeo/feature/types.rb +4 -4
  17. data/lib/rgeo/geo_json/coder.rb +5 -5
  18. data/lib/rgeo/{geography.rb → geographic.rb} +15 -15
  19. data/lib/rgeo/{geography → geographic}/factory.rb +27 -20
  20. data/lib/rgeo/{geography → geographic}/interface.rb +43 -29
  21. data/lib/rgeo/{geography → geographic}/proj4_projector.rb +2 -2
  22. data/lib/rgeo/{geography → geographic}/projected_feature_classes.rb +2 -2
  23. data/lib/rgeo/{geography → geographic}/projected_feature_methods.rb +2 -2
  24. data/lib/rgeo/{geography → geographic}/projected_window.rb +5 -5
  25. data/lib/rgeo/{geography → geographic}/simple_mercator_projector.rb +2 -2
  26. data/lib/rgeo/{geography → geographic}/spherical_feature_classes.rb +2 -2
  27. data/lib/rgeo/{geography → geographic}/spherical_feature_methods.rb +2 -2
  28. data/lib/rgeo/{geography → geographic}/spherical_math.rb +1 -1
  29. data/lib/rgeo/geos/factory.rb +22 -15
  30. data/lib/rgeo/geos/interface.rb +3 -3
  31. data/lib/rgeo/geos/zm_factory.rb +20 -6
  32. data/lib/rgeo/impl_helper/basic_point_methods.rb +2 -2
  33. data/lib/rgeo/shapefile/reader.rb +5 -5
  34. data/lib/rgeo/wkrep/wkb_generator.rb +2 -2
  35. data/lib/rgeo/wkrep/wkb_parser.rb +4 -4
  36. data/lib/rgeo/wkrep/wkt_generator.rb +2 -2
  37. data/lib/rgeo/wkrep/wkt_parser.rb +7 -7
  38. data/test/active_record/common_setup_methods.rb +1 -1
  39. data/test/geos/tc_point.rb +3 -3
  40. data/test/geos/tc_zmfactory.rb +7 -7
  41. data/test/{projected_geography → projected_geographic}/tc_geometry_collection.rb +2 -2
  42. data/test/{projected_geography → projected_geographic}/tc_line_string.rb +2 -2
  43. data/test/{projected_geography → projected_geographic}/tc_multi_line_string.rb +2 -2
  44. data/test/{projected_geography → projected_geographic}/tc_multi_point.rb +2 -2
  45. data/test/{projected_geography → projected_geographic}/tc_multi_polygon.rb +3 -3
  46. data/test/{projected_geography → projected_geographic}/tc_point.rb +5 -5
  47. data/test/{projected_geography → projected_geographic}/tc_polygon.rb +2 -2
  48. data/test/shapefile/tc_shapelib_tests.rb +10 -10
  49. data/test/simple_cartesian/tc_point.rb +3 -3
  50. data/test/simple_mercator/tc_geometry_collection.rb +1 -1
  51. data/test/simple_mercator/tc_line_string.rb +1 -1
  52. data/test/simple_mercator/tc_multi_line_string.rb +1 -1
  53. data/test/simple_mercator/tc_multi_point.rb +1 -1
  54. data/test/simple_mercator/tc_multi_polygon.rb +2 -2
  55. data/test/simple_mercator/tc_point.rb +4 -4
  56. data/test/simple_mercator/tc_polygon.rb +1 -1
  57. data/test/simple_mercator/tc_window.rb +39 -39
  58. data/test/spherical_geographic/tc_calculations.rb +203 -0
  59. data/test/{spherical_geography → spherical_geographic}/tc_geometry_collection.rb +2 -2
  60. data/test/{spherical_geography → spherical_geographic}/tc_line_string.rb +2 -2
  61. data/test/{spherical_geography → spherical_geographic}/tc_multi_line_string.rb +2 -2
  62. data/test/{spherical_geography → spherical_geographic}/tc_multi_point.rb +2 -2
  63. data/test/{spherical_geography → spherical_geographic}/tc_multi_polygon.rb +3 -3
  64. data/test/{spherical_geography → spherical_geographic}/tc_point.rb +6 -6
  65. data/test/{spherical_geography → spherical_geographic}/tc_polygon.rb +2 -2
  66. data/test/tc_geojson.rb +3 -3
  67. data/test/tc_oneoff.rb +5 -5
  68. data/test/wkrep/tc_wkb_generator.rb +3 -3
  69. data/test/wkrep/tc_wkb_parser.rb +16 -16
  70. data/test/wkrep/tc_wkt_generator.rb +3 -3
  71. data/test/wkrep/tc_wkt_parser.rb +21 -21
  72. metadata +46 -44
  73. data/test/spherical_geography/tc_calculations.rb +0 -203
@@ -62,8 +62,8 @@ module RGeo
62
62
 
63
63
 
64
64
  def initialize(opts_={}) # :nodoc:
65
- @zfactory = Factory.create(:support_z_coordinate => true, :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :buffer_resolution => opts_[:buffer_resolution], :srid => opts_[:srid])
66
- @mfactory = Factory.create(:support_m_coordinate => true, :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :buffer_resolution => opts_[:buffer_resolution], :srid => opts_[:srid])
65
+ @zfactory = Factory.create(:has_z_coordinate => true, :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :buffer_resolution => opts_[:buffer_resolution], :srid => opts_[:srid], :proj4 => opts_[:proj4])
66
+ @mfactory = Factory.create(:has_m_coordinate => true, :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :buffer_resolution => opts_[:buffer_resolution], :srid => opts_[:srid], :proj4 => opts_[:proj4])
67
67
  end
68
68
 
69
69
 
@@ -111,14 +111,14 @@ module RGeo
111
111
  alias_method :==, :eql?
112
112
 
113
113
 
114
- # See ::RGeo::Feature::Factory#has_capability?
114
+ # See ::RGeo::Feature::Factory#property
115
115
 
116
- def has_capability?(name_)
116
+ def property(name_)
117
117
  case name_
118
- when :z_coordinate, :m_coordinate
118
+ when :has_z_coordinate, :has_m_coordinate, :is_cartesian
119
119
  true
120
120
  else
121
- @zfactory.has_capability?(name_)
121
+ nil
122
122
  end
123
123
  end
124
124
 
@@ -200,6 +200,20 @@ module RGeo
200
200
  end
201
201
 
202
202
 
203
+ # See ::RGeo::Feature::Factory#proj4
204
+
205
+ def proj4
206
+ @zfactory.proj4
207
+ end
208
+
209
+
210
+ # See ::RGeo::Feature::Factory#coord_sys
211
+
212
+ def coord_sys
213
+ @zfactory.coord_sys
214
+ end
215
+
216
+
203
217
  # See ::RGeo::Feature::Factory#override_cast
204
218
 
205
219
  def override_cast(original_, ntype_, flags_)
@@ -46,8 +46,8 @@ module RGeo
46
46
  _set_factory(factory_)
47
47
  @x = x_.to_f
48
48
  @y = y_.to_f
49
- @z = factory_.has_capability?(:z_coordinate) ? extra_.shift.to_f : nil
50
- @m = factory_.has_capability?(:m_coordinate) ? extra_.shift.to_f : nil
49
+ @z = factory_.property(:has_z_coordinate) ? extra_.shift.to_f : nil
50
+ @m = factory_.property(:has_m_coordinate) ? extra_.shift.to_f : nil
51
51
  if extra_.size > 0
52
52
  raise ::ArgumentError, "Too many arguments for point initializer"
53
53
  end
@@ -162,7 +162,7 @@ module RGeo
162
162
  # A factory generator that should return a factory based on the
163
163
  # srid and dimension settings in the input. The factory generator
164
164
  # should understand the configuration options
165
- # <tt>:support_z_coordinate</tt> and <tt>:support_m_coordinate</tt>.
165
+ # <tt>:has_z_coordinate</tt> and <tt>:has_m_coordinate</tt>.
166
166
  # See RGeo::Feature::FactoryGenerator for more information.
167
167
  # If no generator is provided, the <tt>:default_factory</tt> is
168
168
  # used.
@@ -253,17 +253,17 @@ module RGeo
253
253
  factory_config_ = {}
254
254
  factory_config_[:srid] = opts_[:srid] if opts_[:srid]
255
255
  unless @zmin.nil?
256
- factory_config_[:support_z_coordinate] = true
256
+ factory_config_[:has_z_coordinate] = true
257
257
  end
258
258
  unless @mmin.nil?
259
- factory_config_[:support_m_coordinate] = true
259
+ factory_config_[:has_m_coordinate] = true
260
260
  end
261
261
  @factory = factory_generator_.call(factory_config_)
262
262
  else
263
263
  @factory = opts_[:default_factory] || Cartesian.preferred_factory
264
264
  end
265
- @factory_supports_z = @factory.has_capability?(:z_coordinate)
266
- @factory_supports_m = @factory.has_capability?(:m_coordinate)
265
+ @factory_supports_z = @factory.property(:has_z_coordinate)
266
+ @factory_supports_m = @factory.property(:has_m_coordinate)
267
267
 
268
268
  @assume_inner_follows_outer = opts_[:assume_inner_follows_outer]
269
269
  end
@@ -152,8 +152,8 @@ module RGeo
152
152
  def generate(obj_)
153
153
  factory_ = obj_.factory
154
154
  if @type_format == :ewkb || @type_format == :wkb12
155
- @cur_has_z = factory_.has_capability?(:z_coordinate)
156
- @cur_has_m = factory_.has_capability?(:m_coordinate)
155
+ @cur_has_z = factory_.property(:has_z_coordinate)
156
+ @cur_has_m = factory_.property(:has_m_coordinate)
157
157
  else
158
158
  @cur_has_z = nil
159
159
  @cur_has_m = nil
@@ -51,7 +51,7 @@ module RGeo
51
51
  #
52
52
  # You must provide each parser with an RGeo::Feature::FactoryGenerator.
53
53
  # It should understand the configuration options <tt>:srid</tt>,
54
- # <tt>:support_z_coordinate</tt>, and <tt>:support_m_coordinate</tt>.
54
+ # <tt>:has_z_coordinate</tt>, and <tt>:has_m_coordinate</tt>.
55
55
  # You may also pass a specific RGeo::Feature::Factory, or nil to
56
56
  # specify the default Cartesian FactoryGenerator.
57
57
  #
@@ -220,11 +220,11 @@ module RGeo
220
220
  @cur_has_m = has_m_
221
221
  @cur_dims = 2 + (@cur_has_z ? 1 : 0) + (@cur_has_m ? 1 : 0)
222
222
  @cur_srid = srid_
223
- @cur_factory = @factory_generator.call(:srid => @cur_srid, :support_z_coordinate => has_z_, :support_m_coordinate => has_m_)
224
- if @cur_has_z && !@cur_factory.has_capability?(:z_coordinate)
223
+ @cur_factory = @factory_generator.call(:srid => @cur_srid, :has_z_coordinate => has_z_, :has_m_coordinate => has_m_)
224
+ if @cur_has_z && !@cur_factory.property(:has_z_coordinate)
225
225
  raise Error::ParseError, "Data has Z coordinates but the factory doesn't have z_coordinate capability"
226
226
  end
227
- if @cur_has_m && !@cur_factory.has_capability?(:m_coordinate)
227
+ if @cur_has_m && !@cur_factory.property(:has_m_coordinate)
228
228
  raise Error::ParseError, "Data has M coordinates but the factory doesn't have m_coordinate capability"
229
229
  end
230
230
  end
@@ -145,8 +145,8 @@ module RGeo
145
145
  @cur_support_z = nil
146
146
  @cur_support_m = nil
147
147
  else
148
- @cur_support_z = factory_.has_capability?(:z_coordinate)
149
- @cur_support_m = factory_.has_capability?(:m_coordinate)
148
+ @cur_support_z = factory_.property(:has_z_coordinate)
149
+ @cur_support_m = factory_.property(:has_m_coordinate)
150
150
  end
151
151
  str_ = _generate_feature(obj_, true)
152
152
  if @convert_case == :upper
@@ -54,7 +54,7 @@ module RGeo
54
54
  #
55
55
  # You must provide each parser with an RGeo::Feature::FactoryGenerator.
56
56
  # It should understand the configuration options <tt>:srid</tt>,
57
- # <tt>:support_z_coordinate</tt>, and <tt>:support_m_coordinate</tt>.
57
+ # <tt>:has_z_coordinate</tt>, and <tt>:has_m_coordinate</tt>.
58
58
  # You may also pass a specific RGeo::Feature::Factory, or nil to
59
59
  # specify the default Cartesian FactoryGenerator.
60
60
  #
@@ -179,8 +179,8 @@ module RGeo
179
179
  str_ = str_.downcase
180
180
  @cur_factory = @exact_factory
181
181
  if @cur_factory
182
- @cur_factory_support_z = @cur_factory.has_capability?(:z_coordinate) ? true : false
183
- @cur_factory_support_m = @cur_factory.has_capability?(:m_coordinate) ? true : false
182
+ @cur_factory_support_z = @cur_factory.property(:has_z_coordinate) ? true : false
183
+ @cur_factory_support_m = @cur_factory.property(:has_m_coordinate) ? true : false
184
184
  end
185
185
  @cur_expect_z = nil
186
186
  @cur_expect_m = nil
@@ -214,9 +214,9 @@ module RGeo
214
214
 
215
215
  def _ensure_factory # :nodoc:
216
216
  unless @cur_factory
217
- @cur_factory = @factory_generator.call(:srid => @cur_srid, :support_z_coordinate => @cur_expect_z, :support_m_coordinate => @cur_expect_m)
218
- @cur_factory_support_z = @cur_factory.has_capability?(:z_coordinate) ? true : false
219
- @cur_factory_support_m = @cur_factory.has_capability?(:m_coordinate) ? true : false
217
+ @cur_factory = @factory_generator.call(:srid => @cur_srid, :has_z_coordinate => @cur_expect_z, :has_m_coordinate => @cur_expect_m)
218
+ @cur_factory_support_z = @cur_factory.property(:has_z_coordinate) ? true : false
219
+ @cur_factory_support_m = @cur_factory.property(:has_m_coordinate) ? true : false
220
220
  _check_factory_support unless @cur_expect_z.nil?
221
221
  end
222
222
  @cur_factory
@@ -464,7 +464,7 @@ module RGeo
464
464
  end
465
465
 
466
466
 
467
- def _next_token(expect_=nil) # :nodoc:
467
+ def _next_token # :nodoc:
468
468
  if @_scanner.scan_until(/\(|\)|\[|\]|,|[^\s\(\)\[\],]+/)
469
469
  token_ = @_scanner.matched
470
470
  case token_
@@ -88,7 +88,7 @@ module RGeo
88
88
 
89
89
  def setup
90
90
  @factory = ::RGeo::Cartesian.preferred_factory(:srid => 4326)
91
- @geographic_factory = ::RGeo::Geography.spherical_factory(:srid => 4326)
91
+ @geographic_factory = ::RGeo::Geographic.spherical_factory(:srid => 4326)
92
92
  cleanup_tables
93
93
  end
94
94
 
@@ -49,9 +49,9 @@ module RGeo
49
49
 
50
50
  def setup
51
51
  @factory = ::RGeo::Geos.factory
52
- @zfactory = ::RGeo::Geos.factory(:support_z_coordinate => true)
53
- @mfactory = ::RGeo::Geos.factory(:support_m_coordinate => true)
54
- @zmfactory = ::RGeo::Geos.factory(:support_z_coordinate => true, :support_m_coordinate => true)
52
+ @zfactory = ::RGeo::Geos.factory(:has_z_coordinate => true)
53
+ @mfactory = ::RGeo::Geos.factory(:has_m_coordinate => true)
54
+ @zmfactory = ::RGeo::Geos.factory(:has_z_coordinate => true, :has_m_coordinate => true)
55
55
  end
56
56
 
57
57
 
@@ -46,7 +46,7 @@ module RGeo
46
46
 
47
47
 
48
48
  def setup
49
- @factory = ::RGeo::Geos.factory(:support_z_coordinate => true, :support_m_coordinate => true, :srid => 1000, :buffer_resolution => 2)
49
+ @factory = ::RGeo::Geos.factory(:has_z_coordinate => true, :has_m_coordinate => true, :srid => 1000, :buffer_resolution => 2)
50
50
  end
51
51
 
52
52
 
@@ -57,12 +57,12 @@ module RGeo
57
57
  assert_equal(2, @factory.buffer_resolution)
58
58
  assert_equal(2, @factory.z_factory.buffer_resolution)
59
59
  assert_equal(2, @factory.m_factory.buffer_resolution)
60
- assert(@factory.has_capability?(:z_coordinate))
61
- assert(@factory.has_capability?(:m_coordinate))
62
- assert(@factory.z_factory.has_capability?(:z_coordinate))
63
- assert(!@factory.z_factory.has_capability?(:m_coordinate))
64
- assert(!@factory.m_factory.has_capability?(:z_coordinate))
65
- assert(@factory.m_factory.has_capability?(:m_coordinate))
60
+ assert(@factory.property(:has_z_coordinate))
61
+ assert(@factory.property(:has_m_coordinate))
62
+ assert(@factory.z_factory.property(:has_z_coordinate))
63
+ assert(!@factory.z_factory.property(:has_m_coordinate))
64
+ assert(!@factory.m_factory.property(:has_z_coordinate))
65
+ assert(@factory.m_factory.property(:has_m_coordinate))
66
66
  end
67
67
 
68
68
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/geometry_collection_tests.rb', ::File.dirn
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module ProjectedGeography # :nodoc:
45
+ module ProjectedGeographic # :nodoc:
46
46
 
47
47
  class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factory
51
- ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
51
+ ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
52
  end
53
53
 
54
54
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/line_string_tests.rb', ::File.dirname(__FI
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module ProjectedGeography # :nodoc:
45
+ module ProjectedGeographic # :nodoc:
46
46
 
47
47
  class TestLineString < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def setup
51
- @factory = ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
51
+ @factory = ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
52
  end
53
53
 
54
54
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/multi_line_string_tests.rb', ::File.dirnam
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module ProjectedGeography # :nodoc:
45
+ module ProjectedGeographic # :nodoc:
46
46
 
47
47
  class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factory
51
- ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
51
+ ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
52
  end
53
53
 
54
54
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FI
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module ProjectedGeography # :nodoc:
45
+ module ProjectedGeographic # :nodoc:
46
46
 
47
47
  class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factory
51
- ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
51
+ ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
52
  end
53
53
 
54
54
 
@@ -42,14 +42,14 @@ require ::File.expand_path('../common/multi_polygon_tests.rb', ::File.dirname(__
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module ProjectedGeography # :nodoc:
45
+ module ProjectedGeographic # :nodoc:
46
46
 
47
47
  class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def create_factories
51
- @factory = ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
- @lenient_factory = ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857, :lenient_multi_polygon_assertions => true)
51
+ @factory = ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
+ @lenient_factory = ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857, :lenient_multi_polygon_assertions => true)
53
53
  end
54
54
 
55
55
 
@@ -42,16 +42,16 @@ require ::File.expand_path('../common/point_tests.rb', ::File.dirname(__FILE__))
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module ProjectedGeography # :nodoc:
45
+ module ProjectedGeographic # :nodoc:
46
46
 
47
47
  class TestPoint < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def setup
51
- @factory = ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
- @zfactory = ::RGeo::Geography.projected_factory(:support_z_coordinate => true, :projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
53
- @mfactory = ::RGeo::Geography.projected_factory(:support_m_coordinate => true, :projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
54
- @zmfactory = ::RGeo::Geography.projected_factory(:support_z_coordinate => true, :support_m_coordinate => true, :projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
51
+ @factory = ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
+ @zfactory = ::RGeo::Geographic.projected_factory(:has_z_coordinate => true, :projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
53
+ @mfactory = ::RGeo::Geographic.projected_factory(:has_m_coordinate => true, :projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
54
+ @zmfactory = ::RGeo::Geographic.projected_factory(:has_z_coordinate => true, :has_m_coordinate => true, :projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
55
55
  end
56
56
 
57
57
 
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/polygon_tests.rb', ::File.dirname(__FILE__
42
42
 
43
43
  module RGeo
44
44
  module Tests # :nodoc:
45
- module ProjectedGeography # :nodoc:
45
+ module ProjectedGeographic # :nodoc:
46
46
 
47
47
  class TestPolygon < ::Test::Unit::TestCase # :nodoc:
48
48
 
49
49
 
50
50
  def setup
51
- @factory = ::RGeo::Geography.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
51
+ @factory = ::RGeo::Geographic.projected_factory(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857)
52
52
  end
53
53
 
54
54
 
@@ -126,8 +126,8 @@ module RGeo
126
126
  _open_shapefile(filename_) do |file_|
127
127
  assert_equal(has_z_ ? 11 : has_m_ ? 21 : 1, file_.shape_type_code)
128
128
  assert_equal(2, file_.num_records)
129
- assert_equal(has_z_, file_.factory.has_capability?(:z_coordinate))
130
- assert_equal(has_m_, file_.factory.has_capability?(:m_coordinate))
129
+ assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
130
+ assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
131
131
  rec_ = file_.next
132
132
  assert_equal(0, rec_.index)
133
133
  assert_equal(::RGeo::Feature::Point, rec_.geometry.geometry_type)
@@ -166,8 +166,8 @@ module RGeo
166
166
  _open_shapefile(filename_) do |file_|
167
167
  assert_equal(has_z_ ? 18 : has_m_ ? 28 : 8, file_.shape_type_code)
168
168
  assert_equal(3, file_.num_records)
169
- assert_equal(has_z_, file_.factory.has_capability?(:z_coordinate))
170
- assert_equal(has_m_, file_.factory.has_capability?(:m_coordinate))
169
+ assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
170
+ assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
171
171
  rec_ = file_.next
172
172
  assert_equal(::RGeo::Feature::MultiPoint, rec_.geometry.geometry_type)
173
173
  assert_equal(4, rec_.geometry.num_geometries)
@@ -217,8 +217,8 @@ module RGeo
217
217
  _open_shapefile(filename_) do |file_|
218
218
  assert_equal(has_z_ ? 13 : has_m_ ? 23 : 3, file_.shape_type_code)
219
219
  assert_equal(4, file_.num_records)
220
- assert_equal(has_z_, file_.factory.has_capability?(:z_coordinate))
221
- assert_equal(has_m_, file_.factory.has_capability?(:m_coordinate))
220
+ assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
221
+ assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
222
222
  rec_ = file_.next
223
223
  assert_equal(::RGeo::Feature::MultiLineString, rec_.geometry.geometry_type)
224
224
  assert_equal(1, rec_.geometry.num_geometries)
@@ -327,8 +327,8 @@ module RGeo
327
327
  _open_shapefile(filename_) do |file_|
328
328
  assert_equal(has_z_ ? 15 : has_m_ ? 25 : 5, file_.shape_type_code)
329
329
  assert_equal(4, file_.num_records)
330
- assert_equal(has_z_, file_.factory.has_capability?(:z_coordinate))
331
- assert_equal(has_m_, file_.factory.has_capability?(:m_coordinate))
330
+ assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
331
+ assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
332
332
  rec_ = file_.next
333
333
  assert_equal(::RGeo::Feature::MultiPolygon, rec_.geometry.geometry_type)
334
334
  assert_equal(1, rec_.geometry.num_geometries)
@@ -440,11 +440,11 @@ module RGeo
440
440
  _open_shapefile('test13') do |file_|
441
441
  assert_equal(31, file_.shape_type_code)
442
442
  assert_equal(4, file_.num_records)
443
- assert_equal(true, file_.factory.has_capability?(:z_coordinate))
443
+ assert_equal(true, file_.factory.property(:has_z_coordinate))
444
444
  # I believe shapefile's test13 incorrectly includes bounding
445
445
  # box data for m, since there is no actual m data. So I
446
446
  # disabled this test:
447
- # assert_equal(false, file_.factory.has_capability?(:m_coordinate))
447
+ # assert_equal(false, file_.factory.property(:has_m_coordinate))
448
448
  rec_ = file_.next
449
449
  assert_equal(::RGeo::Feature::GeometryCollection, rec_.geometry.geometry_type)
450
450
  assert_equal(1, rec_.geometry.num_geometries)
@@ -49,9 +49,9 @@ module RGeo
49
49
 
50
50
  def setup
51
51
  @factory = ::RGeo::Cartesian.simple_factory(:srid => 1)
52
- @zfactory = ::RGeo::Cartesian.simple_factory(:srid => 1, :support_z_coordinate => true)
53
- @mfactory = ::RGeo::Cartesian.simple_factory(:srid => 1, :support_m_coordinate => true)
54
- @zmfactory = ::RGeo::Cartesian.simple_factory(:srid => 1, :support_z_coordinate => true, :support_m_coordinate => true)
52
+ @zfactory = ::RGeo::Cartesian.simple_factory(:srid => 1, :has_z_coordinate => true)
53
+ @mfactory = ::RGeo::Cartesian.simple_factory(:srid => 1, :has_m_coordinate => true)
54
+ @zmfactory = ::RGeo::Cartesian.simple_factory(:srid => 1, :has_z_coordinate => true, :has_m_coordinate => true)
55
55
  end
56
56
 
57
57
 
@@ -48,7 +48,7 @@ module RGeo
48
48
 
49
49
 
50
50
  def create_factory
51
- ::RGeo::Geography.simple_mercator_factory
51
+ ::RGeo::Geographic.simple_mercator_factory
52
52
  end
53
53
 
54
54