georuby 2.3.0 → 2.5.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -9
  3. data/Rakefile +13 -14
  4. data/lib/geo_ruby/ewk.rb +2 -0
  5. data/lib/geo_ruby/{simple_features → ewk}/ewkb_parser.rb +206 -218
  6. data/lib/geo_ruby/ewk/ewkt_parser.rb +321 -0
  7. data/lib/geo_ruby/geojson.rb +27 -32
  8. data/lib/geo_ruby/georss.rb +88 -66
  9. data/lib/geo_ruby/gpx.rb +113 -1
  10. data/lib/geo_ruby/kml.rb +43 -31
  11. data/lib/geo_ruby/shp.rb +1 -0
  12. data/lib/geo_ruby/shp4r/dbf.rb +7 -3
  13. data/lib/geo_ruby/shp4r/shp.rb +297 -284
  14. data/lib/geo_ruby/simple_features.rb +2 -6
  15. data/lib/geo_ruby/simple_features/circle.rb +15 -13
  16. data/lib/geo_ruby/simple_features/envelope.rb +84 -77
  17. data/lib/geo_ruby/simple_features/geometry.rb +89 -69
  18. data/lib/geo_ruby/simple_features/geometry_collection.rb +46 -43
  19. data/lib/geo_ruby/simple_features/geometry_factory.rb +50 -47
  20. data/lib/geo_ruby/simple_features/helper.rb +14 -14
  21. data/lib/geo_ruby/simple_features/line_string.rb +94 -97
  22. data/lib/geo_ruby/simple_features/linear_ring.rb +4 -9
  23. data/lib/geo_ruby/simple_features/multi_line_string.rb +18 -21
  24. data/lib/geo_ruby/simple_features/multi_point.rb +18 -20
  25. data/lib/geo_ruby/simple_features/multi_polygon.rb +19 -25
  26. data/lib/geo_ruby/simple_features/point.rb +134 -128
  27. data/lib/geo_ruby/simple_features/polygon.rb +60 -59
  28. data/lib/geo_ruby/version.rb +1 -1
  29. data/spec/data/geojson/feature.json +9 -0
  30. data/spec/data/geojson/feature_collection.json +3 -4
  31. data/spec/geo_ruby/{simple_features → ewk}/ewkb_parser_spec.rb +56 -57
  32. data/spec/geo_ruby/{simple_features → ewk}/ewkt_parser_spec.rb +62 -63
  33. data/spec/geo_ruby/geojson_spec.rb +34 -17
  34. data/spec/geo_ruby/georss_spec.rb +76 -64
  35. data/spec/geo_ruby/{gpx4r/gpx_spec.rb → gpx_spec.rb} +25 -25
  36. data/spec/geo_ruby/kml_spec.rb +40 -36
  37. data/spec/geo_ruby/shp4r/shp_spec.rb +51 -51
  38. data/spec/geo_ruby/simple_features/circle_spec.rb +2 -2
  39. data/spec/geo_ruby/simple_features/envelope_spec.rb +8 -8
  40. data/spec/geo_ruby/simple_features/geometry_collection_spec.rb +26 -26
  41. data/spec/geo_ruby/simple_features/geometry_factory_spec.rb +5 -5
  42. data/spec/geo_ruby/simple_features/geometry_spec.rb +8 -8
  43. data/spec/geo_ruby/simple_features/line_string_spec.rb +102 -102
  44. data/spec/geo_ruby/simple_features/linear_ring_spec.rb +7 -7
  45. data/spec/geo_ruby/simple_features/multi_line_string_spec.rb +20 -20
  46. data/spec/geo_ruby/simple_features/multi_point_spec.rb +16 -16
  47. data/spec/geo_ruby/simple_features/multi_polygon_spec.rb +19 -19
  48. data/spec/geo_ruby/simple_features/point_spec.rb +180 -174
  49. data/spec/geo_ruby/simple_features/polygon_spec.rb +55 -56
  50. data/spec/geo_ruby_spec.rb +4 -4
  51. data/spec/spec_helper.rb +19 -13
  52. metadata +10 -9
  53. data/lib/geo_ruby/gpx4r/gpx.rb +0 -118
  54. data/lib/geo_ruby/simple_features/ewkt_parser.rb +0 -336
@@ -2,21 +2,21 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
3
  describe GeoRuby::SimpleFeatures::LinearRing do
4
4
 
5
- it "should instantiate" do
5
+ it 'should instantiate' do
6
6
  lr = GeoRuby::SimpleFeatures::LinearRing.new(4326)
7
7
  expect(lr).to be_instance_of(GeoRuby::SimpleFeatures::LinearRing)
8
8
  end
9
9
 
10
- describe "Instance" do
10
+ describe 'Instance' do
11
11
 
12
- let(:lr) { GeoRuby::SimpleFeatures::LinearRing.from_coordinates([[10,10],[20,45],[45,10],[10, 10]],256) }
12
+ let(:lr) { GeoRuby::SimpleFeatures::LinearRing.from_coordinates([[10, 10], [20, 45], [45, 10], [10, 10]], 256) }
13
13
 
14
- it "should test if contains a point" do
15
- expect(lr.contains_point?(GeoRuby::SimpleFeatures::Point.from_x_y(21,21))).to be_truthy
14
+ it 'should test if contains a point' do
15
+ expect(lr.contains_point?(GeoRuby::SimpleFeatures::Point.from_x_y(21, 21))).to be_truthy
16
16
  end
17
17
 
18
- it "should test if not contains a point" do
19
- expect(lr.contains_point?(GeoRuby::SimpleFeatures::Point.from_x_y(21,51))).to be_falsey
18
+ it 'should test if not contains a point' do
19
+ expect(lr.contains_point?(GeoRuby::SimpleFeatures::Point.from_x_y(21, 51))).to be_falsey
20
20
  end
21
21
 
22
22
  end
@@ -2,50 +2,50 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
3
  describe GeoRuby::SimpleFeatures::MultiLineString do
4
4
 
5
- it "test_multi_line_string_creation" do
6
- multi_line_string1 = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
5
+ it 'test_multi_line_string_creation' do
6
+ multi_line_string1 = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012]], 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012], [45.123, 123.3]], 256)], 256)
7
7
  expect(multi_line_string1).to be_instance_of(GeoRuby::SimpleFeatures::MultiLineString)
8
8
  expect(multi_line_string1.length).to eql(2)
9
- expect(multi_line_string1[0]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256))
9
+ expect(multi_line_string1[0]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012]], 256))
10
10
 
11
- multi_line_string2= GeoRuby::SimpleFeatures::MultiLineString.from_coordinates([[[1.5,45.2],[-54.12312,-0.012]],[[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]]],256);
11
+ multi_line_string2 = GeoRuby::SimpleFeatures::MultiLineString.from_coordinates([[[1.5, 45.2], [-54.12312, -0.012]], [[1.5, 45.2], [-54.12312, -0.012], [45.123, 123.3]]], 256)
12
12
  expect(multi_line_string1).to be_instance_of(GeoRuby::SimpleFeatures::MultiLineString)
13
13
  expect(multi_line_string1.length).to eql(2)
14
- expect(multi_line_string2[0]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256))
14
+ expect(multi_line_string2[0]).to eq(GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012]], 256))
15
15
 
16
16
  expect(multi_line_string2).to eq(multi_line_string2)
17
17
  end
18
18
 
19
- it "test_multi_line_string_binary" do
20
- multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
21
- expect(multi_line_string.as_hex_ewkb).to eql("01050000200001000002000000010200000002000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF010200000003000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF39B4C876BE8F46403333333333D35E40")
19
+ it 'test_multi_line_string_binary' do
20
+ multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012]], 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012], [45.123, 123.3]], 256)], 256)
21
+ expect(multi_line_string.as_hex_ewkb).to eql('01050000200001000002000000010200000002000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF010200000003000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF39B4C876BE8F46403333333333D35E40')
22
22
 
23
- multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2,1.3,1.2],[-54.12312,-0.012,1.2,4.5]],256,true,true),GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2,5.1,-4.5],[-54.12312,-0.012,-6.8,3.4],[45.123,123.3,4.5,-5.3]],256,true,true)],256,true,true)
24
- expect(multi_line_string.as_hex_ewkb).to eql("0105000020000100000200000001020000C002000000000000000000F83F9A99999999994640CDCCCCCCCCCCF43F333333333333F33FE4BD6A65C20F4BC0FA7E6ABC749388BF333333333333F33F000000000000124001020000C003000000000000000000F83F9A99999999994640666666666666144000000000000012C0E4BD6A65C20F4BC0FA7E6ABC749388BF3333333333331BC03333333333330B4039B4C876BE8F46403333333333D35E40000000000000124033333333333315C0")
23
+ multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2, 1.3, 1.2], [-54.12312, -0.012, 1.2, 4.5]], 256, true, true), GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2, 5.1, -4.5], [-54.12312, -0.012, -6.8, 3.4], [45.123, 123.3, 4.5, -5.3]], 256, true, true)], 256, true, true)
24
+ expect(multi_line_string.as_hex_ewkb).to eql('0105000020000100000200000001020000C002000000000000000000F83F9A99999999994640CDCCCCCCCCCCF43F333333333333F33FE4BD6A65C20F4BC0FA7E6ABC749388BF333333333333F33F000000000000124001020000C003000000000000000000F83F9A99999999994640666666666666144000000000000012C0E4BD6A65C20F4BC0FA7E6ABC749388BF3333333333331BC03333333333330B4039B4C876BE8F46403333333333D35E40000000000000124033333333333315C0')
25
25
  end
26
26
 
27
- it "test_multi_line_string_text" do
28
- multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
29
- expect(multi_line_string.as_ewkt).to eql("SRID=256;MULTILINESTRING((1.5 45.2,-54.12312 -0.012),(1.5 45.2,-54.12312 -0.012,45.123 123.3))")
27
+ it 'test_multi_line_string_text' do
28
+ multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012]], 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012], [45.123, 123.3]], 256)], 256)
29
+ expect(multi_line_string.as_ewkt).to eql('SRID=256;MULTILINESTRING((1.5 45.2,-54.12312 -0.012),(1.5 45.2,-54.12312 -0.012,45.123 123.3))')
30
30
 
31
- multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2,1.3,1.2],[-54.12312,-0.012,1.2,4.5]],256,true,true),GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2,5.1,-4.5],[-54.12312,-0.012,-6.8,3.4],[45.123,123.3,4.5,-5.3]],256,true,true)],256,true,true)
32
- expect(multi_line_string.as_ewkt).to eql("SRID=256;MULTILINESTRING((1.5 45.2 1.3 1.2,-54.12312 -0.012 1.2 4.5),(1.5 45.2 5.1 -4.5,-54.12312 -0.012 -6.8 3.4,45.123 123.3 4.5 -5.3))")
31
+ multi_line_string = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2, 1.3, 1.2], [-54.12312, -0.012, 1.2, 4.5]], 256, true, true), GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2, 5.1, -4.5], [-54.12312, -0.012, -6.8, 3.4], [45.123, 123.3, 4.5, -5.3]], 256, true, true)], 256, true, true)
32
+ expect(multi_line_string.as_ewkt).to eql('SRID=256;MULTILINESTRING((1.5 45.2 1.3 1.2,-54.12312 -0.012 1.2 4.5),(1.5 45.2 5.1 -4.5,-54.12312 -0.012 -6.8 3.4,45.123 123.3 4.5 -5.3))')
33
33
  end
34
34
 
35
- describe "Some More" do
35
+ describe 'Some More' do
36
36
  before do
37
- @mls = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
37
+ @mls = GeoRuby::SimpleFeatures::MultiLineString.from_line_strings([GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012]], 256), GeoRuby::SimpleFeatures::LineString.from_coordinates([[1.5, 45.2], [-54.12312, -0.012], [45.123, 123.3]], 256)], 256)
38
38
  end
39
39
 
40
- it "should have a accessor to all points" do
40
+ it 'should have a accessor to all points' do
41
41
  expect(@mls.points).to be_instance_of(Array)
42
42
  end
43
43
 
44
- it "should flatten the array" do
44
+ it 'should flatten the array' do
45
45
  expect(@mls.points.size).to eq(5)
46
46
  end
47
47
 
48
- it "should simplify to linestring" do
48
+ it 'should simplify to linestring' do
49
49
  ls = @mls.to_line_string
50
50
  expect(ls).to be_instance_of(GeoRuby::SimpleFeatures::LineString)
51
51
  expect(ls.points.size).to eq(5)
@@ -2,32 +2,32 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
3
  describe GeoRuby::SimpleFeatures::MultiPoint do
4
4
 
5
- it "test_multi_point_creation" do
6
- multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
5
+ it 'test_multi_point_creation' do
6
+ multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4, -123.3], [-65.1, 123.4], [123.55555555, 123]], 444)
7
7
  expect(multi_point).to be_instance_of(GeoRuby::SimpleFeatures::MultiPoint)
8
8
  expect(multi_point.length).to eql(3)
9
- expect(multi_point[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,-123.3,444))
10
- expect(multi_point[2]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(123.55555555,123,444))
9
+ expect(multi_point[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4, -123.3, 444))
10
+ expect(multi_point[2]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(123.55555555, 123, 444))
11
11
  end
12
12
 
13
- it "test_multi_point_binary" do
14
- multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
15
- expect(multi_point.as_hex_ewkb).to eql("0104000020BC010000030000000101000000CDCCCCCCCCCC28403333333333D35EC0010100000066666666664650C09A99999999D95E4001010000001F97DD388EE35E400000000000C05E40")
13
+ it 'test_multi_point_binary' do
14
+ multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4, -123.3], [-65.1, 123.4], [123.55555555, 123]], 444)
15
+ expect(multi_point.as_hex_ewkb).to eql('0104000020BC010000030000000101000000CDCCCCCCCCCC28403333333333D35EC0010100000066666666664650C09A99999999D95E4001010000001F97DD388EE35E400000000000C05E40')
16
16
 
17
- multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3,4.5],[-65.1,123.4,1.2],[123.55555555,123,2.3]],444,true)
18
- expect(multi_point.as_hex_ewkb).to eql("01040000A0BC010000030000000101000080CDCCCCCCCCCC28403333333333D35EC00000000000001240010100008066666666664650C09A99999999D95E40333333333333F33F01010000801F97DD388EE35E400000000000C05E406666666666660240")
17
+ multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4, -123.3, 4.5], [-65.1, 123.4, 1.2], [123.55555555, 123, 2.3]], 444, true)
18
+ expect(multi_point.as_hex_ewkb).to eql('01040000A0BC010000030000000101000080CDCCCCCCCCCC28403333333333D35EC00000000000001240010100008066666666664650C09A99999999D95E40333333333333F33F01010000801F97DD388EE35E400000000000C05E406666666666660240')
19
19
  end
20
20
 
21
- it "test_multi_point_text" do
22
- multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
23
- expect(multi_point.as_ewkt).to eql("SRID=444;MULTIPOINT((12.4 -123.3),(-65.1 123.4),(123.55555555 123))")
21
+ it 'test_multi_point_text' do
22
+ multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4, -123.3], [-65.1, 123.4], [123.55555555, 123]], 444)
23
+ expect(multi_point.as_ewkt).to eql('SRID=444;MULTIPOINT((12.4 -123.3),(-65.1 123.4),(123.55555555 123))')
24
24
 
25
- multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3,4.5],[-65.1,123.4,6.7],[123.55555555,123,7.8]],444,true)
26
- expect(multi_point.as_ewkt).to eql("SRID=444;MULTIPOINT((12.4 -123.3 4.5),(-65.1 123.4 6.7),(123.55555555 123 7.8))")
25
+ multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4, -123.3, 4.5], [-65.1, 123.4, 6.7], [123.55555555, 123, 7.8]], 444, true)
26
+ expect(multi_point.as_ewkt).to eql('SRID=444;MULTIPOINT((12.4 -123.3 4.5),(-65.1 123.4 6.7),(123.55555555 123 7.8))')
27
27
  end
28
28
 
29
- it "should respond to points" do
30
- mp = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
29
+ it 'should respond to points' do
30
+ mp = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4, -123.3], [-65.1, 123.4], [123.55555555, 123]], 444)
31
31
  expect(mp.geometries.size).to eq(3)
32
32
  expect(mp.size).to eq(3)
33
33
  end
@@ -2,47 +2,47 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
3
  describe GeoRuby::SimpleFeatures::MultiPolygon do
4
4
 
5
- it "test_multi_polygon_creation" do
6
- multi_polygon1 = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
5
+ it 'test_multi_polygon_creation' do
6
+ multi_polygon1 = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], [[2.4, 5.3], [5.4, 1.4263], [14.46, 1.06], [2.4, 5.3]]], 256), GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], 256)], 256)
7
7
  expect(multi_polygon1).to be_instance_of(GeoRuby::SimpleFeatures::MultiPolygon)
8
8
  expect(multi_polygon1.length).to eql(2)
9
- expect(multi_polygon1[0]).to eq(GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256))
9
+ expect(multi_polygon1[0]).to eq(GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], [[2.4, 5.3], [5.4, 1.4263], [14.46, 1.06], [2.4, 5.3]]], 256))
10
10
 
11
- multi_polygon2 = GeoRuby::SimpleFeatures::MultiPolygon.from_coordinates([[[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],[[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]]],256)
11
+ multi_polygon2 = GeoRuby::SimpleFeatures::MultiPolygon.from_coordinates([[[[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], [[2.4, 5.3], [5.4, 1.4263], [14.46, 1.06], [2.4, 5.3]]], [[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]]], 256)
12
12
  expect(multi_polygon1).to be_instance_of(GeoRuby::SimpleFeatures::MultiPolygon)
13
13
  expect(multi_polygon1.length).to eql(2)
14
14
 
15
- expect(multi_polygon2[0]).to eq(GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256))
15
+ expect(multi_polygon2[0]).to eq(GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], [[2.4, 5.3], [5.4, 1.4263], [14.46, 1.06], [2.4, 5.3]]], 256))
16
16
  expect(multi_polygon1).to eq(multi_polygon2)
17
17
  end
18
18
 
19
- it "test_multi_polygon_binary" do
20
- multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
21
- expect(multi_polygon.as_hex_ewkb).to eql("0106000020000100000200000001030000000200000004000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC44406DE7FBA9F1D211403D2CD49AE61DF13FCDCCCCCCCCCC28406666666666A646C004000000333333333333034033333333333315409A999999999915408A8EE4F21FD2F63FEC51B81E85EB2C40F6285C8FC2F5F03F3333333333330340333333333333154001030000000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F")
19
+ it 'test_multi_polygon_binary' do
20
+ multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], [[2.4, 5.3], [5.4, 1.4263], [14.46, 1.06], [2.4, 5.3]]], 256), GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], 256)], 256)
21
+ expect(multi_polygon.as_hex_ewkb).to eql('0106000020000100000200000001030000000200000004000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC44406DE7FBA9F1D211403D2CD49AE61DF13FCDCCCCCCCCCC28406666666666A646C004000000333333333333034033333333333315409A999999999915408A8EE4F21FD2F63FEC51B81E85EB2C40F6285C8FC2F5F03F3333333333330340333333333333154001030000000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F')
22
22
 
23
- multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3,1.2],[45.4,41.6,1.2],[4.456,1.0698,1.2],[12.4,-45.3,1.2]],[[2.4,5.3,1.2],[5.4,1.4263,1.2],[14.46,1.06,1.2],[2.4,5.3,1.2]]],256,false,true),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0,1.2],[4,0,1.2],[4,4,2.3],[0,4,1.2],[0,0,1.2]],[[1,1,2.2],[3,1,3.3],[3,3,1.1],[1,3,2.4],[1,1,2.2]]],256,false,true)],256,false,true)
24
- expect(multi_polygon.as_hex_ewkb).to eql("0106000020000100000200000001030000400200000004000000CDCCCCCCCCCC28406666666666A646C0333333333333F33F3333333333B34640CDCCCCCCCCCC4440333333333333F33F6DE7FBA9F1D211403D2CD49AE61DF13F333333333333F33FCDCCCCCCCCCC28406666666666A646C0333333333333F33F0400000033333333333303403333333333331540333333333333F33F9A999999999915408A8EE4F21FD2F63F333333333333F33FEC51B81E85EB2C40F6285C8FC2F5F03F333333333333F33F33333333333303403333333333331540333333333333F33F0103000040020000000500000000000000000000000000000000000000333333333333F33F00000000000010400000000000000000333333333333F33F00000000000010400000000000001040666666666666024000000000000000000000000000001040333333333333F33F00000000000000000000000000000000333333333333F33F05000000000000000000F03F000000000000F03F9A999999999901400000000000000840000000000000F03F6666666666660A40000000000000084000000000000008409A9999999999F13F000000000000F03F00000000000008403333333333330340000000000000F03F000000000000F03F9A99999999990140")
23
+ multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3, 1.2], [45.4, 41.6, 1.2], [4.456, 1.0698, 1.2], [12.4, -45.3, 1.2]], [[2.4, 5.3, 1.2], [5.4, 1.4263, 1.2], [14.46, 1.06, 1.2], [2.4, 5.3, 1.2]]], 256, false, true), GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0, 1.2], [4, 0, 1.2], [4, 4, 2.3], [0, 4, 1.2], [0, 0, 1.2]], [[1, 1, 2.2], [3, 1, 3.3], [3, 3, 1.1], [1, 3, 2.4], [1, 1, 2.2]]], 256, false, true)], 256, false, true)
24
+ expect(multi_polygon.as_hex_ewkb).to eql('0106000020000100000200000001030000400200000004000000CDCCCCCCCCCC28406666666666A646C0333333333333F33F3333333333B34640CDCCCCCCCCCC4440333333333333F33F6DE7FBA9F1D211403D2CD49AE61DF13F333333333333F33FCDCCCCCCCCCC28406666666666A646C0333333333333F33F0400000033333333333303403333333333331540333333333333F33F9A999999999915408A8EE4F21FD2F63F333333333333F33FEC51B81E85EB2C40F6285C8FC2F5F03F333333333333F33F33333333333303403333333333331540333333333333F33F0103000040020000000500000000000000000000000000000000000000333333333333F33F00000000000010400000000000000000333333333333F33F00000000000010400000000000001040666666666666024000000000000000000000000000001040333333333333F33F00000000000000000000000000000000333333333333F33F05000000000000000000F03F000000000000F03F9A999999999901400000000000000840000000000000F03F6666666666660A40000000000000084000000000000008409A9999999999F13F000000000000F03F00000000000008403333333333330340000000000000F03F000000000000F03F9A99999999990140')
25
25
  end
26
26
 
27
- it "test_multi_polygon_text" do
28
- multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
29
- expect(multi_polygon.as_ewkt).to eql("SRID=256;MULTIPOLYGON(((12.4 -45.3,45.4 41.6,4.456 1.0698,12.4 -45.3),(2.4 5.3,5.4 1.4263,14.46 1.06,2.4 5.3)),((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1)))")
27
+ it 'test_multi_polygon_text' do
28
+ multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], [[2.4, 5.3], [5.4, 1.4263], [14.46, 1.06], [2.4, 5.3]]], 256), GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], 256)], 256)
29
+ expect(multi_polygon.as_ewkt).to eql('SRID=256;MULTIPOLYGON(((12.4 -45.3,45.4 41.6,4.456 1.0698,12.4 -45.3),(2.4 5.3,5.4 1.4263,14.46 1.06,2.4 5.3)),((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1)))')
30
30
 
31
- multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3,2],[45.4,41.6,3],[4.456,1.0698,4],[12.4,-45.3,2]],[[2.4,5.3,1],[5.4,1.4263,3.44],[14.46,1.06,4.5],[2.4,5.3,1]]],4326,true),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0,5.6],[4,0,5.4],[4,4,1],[0,4,23],[0,0,5.6]],[[1,1,2.3],[3,1,4],[3,3,5],[1,3,6],[1,1,2.3]]],4326,true)],4326,true)
32
- expect(multi_polygon.as_ewkt).to eql("SRID=4326;MULTIPOLYGON(((12.4 -45.3 2,45.4 41.6 3,4.456 1.0698 4,12.4 -45.3 2),(2.4 5.3 1,5.4 1.4263 3.44,14.46 1.06 4.5,2.4 5.3 1)),((0 0 5.6,4 0 5.4,4 4 1,0 4 23,0 0 5.6),(1 1 2.3,3 1 4,3 3 5,1 3 6,1 1 2.3)))")
31
+ multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3, 2], [45.4, 41.6, 3], [4.456, 1.0698, 4], [12.4, -45.3, 2]], [[2.4, 5.3, 1], [5.4, 1.4263, 3.44], [14.46, 1.06, 4.5], [2.4, 5.3, 1]]], 4326, true), GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0, 5.6], [4, 0, 5.4], [4, 4, 1], [0, 4, 23], [0, 0, 5.6]], [[1, 1, 2.3], [3, 1, 4], [3, 3, 5], [1, 3, 6], [1, 1, 2.3]]], 4326, true)], 4326, true)
32
+ expect(multi_polygon.as_ewkt).to eql('SRID=4326;MULTIPOLYGON(((12.4 -45.3 2,45.4 41.6 3,4.456 1.0698 4,12.4 -45.3 2),(2.4 5.3 1,5.4 1.4263 3.44,14.46 1.06 4.5,2.4 5.3 1)),((0 0 5.6,4 0 5.4,4 4 1,0 4 23,0 0 5.6),(1 1 2.3,3 1 4,3 3 5,1 3 6,1 1 2.3)))')
33
33
  end
34
34
 
35
- describe "Counting" do
35
+ describe 'Counting' do
36
36
 
37
37
  before do
38
- @mp = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
38
+ @mp = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4, -45.3], [45.4, 41.6], [4.456, 1.0698], [12.4, -45.3]], [[2.4, 5.3], [5.4, 1.4263], [14.46, 1.06], [2.4, 5.3]]], 256), GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]], [[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]], 256)], 256)
39
39
  end
40
40
 
41
- it "should have a points method" do
41
+ it 'should have a points method' do
42
42
  expect(@mp.points[0]).to be_instance_of(GeoRuby::SimpleFeatures::Point)
43
43
  end
44
44
 
45
- it "should flatten it right" do
45
+ it 'should flatten it right' do
46
46
  expect(@mp.points.size).to eq(18)
47
47
  end
48
48
 
@@ -4,72 +4,73 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
4
4
  describe GeoRuby::SimpleFeatures::Point do
5
5
  let(:point) { GeoRuby::SimpleFeatures::Point.new(4326) }
6
6
 
7
- it "should instantiatember" do
7
+ it 'should instantiatember' do
8
8
  violated unless point
9
9
  expect(point).to be_instance_of(GeoRuby::SimpleFeatures::Point)
10
10
  end
11
11
 
12
- it "should have a nice matcher" do
12
+ it 'should have a nice matcher' do
13
13
  expect(point).to be_a_point
14
14
  end
15
15
 
16
- it "should have a text geometry type" do
17
- expect(point.text_geometry_type).to eq("POINT")
16
+ it 'should have a text geometry type' do
17
+ expect(point.text_geometry_type).to eq('POINT')
18
18
  end
19
19
 
20
- it "should have a very nice matcher" do
20
+ it 'should have a very nice matcher' do
21
21
  expect(point).to be_a_point(0.0, 0.0)
22
22
  end
23
23
 
24
- it "should have a very nice matcher" do
25
- expect(GeoRuby::SimpleFeatures::Point.from_x_y_z_m(1,2,3.33,"t")).to be_a_point(1, 2, 3.33, "t")
24
+ it 'should have a very nice matcher' do
25
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y_z_m(1, 2, 3.33, 't'))
26
+ .to be_a_point(1, 2, 3.33, 't')
26
27
  end
27
28
 
28
- it "should have a dumb matcher" do
29
+ it 'should have a dumb matcher' do
29
30
  expect(GeoRuby::SimpleFeatures::Point).to be_geometric
30
31
  end
31
32
 
32
- it "should be subclassable" do
33
+ it 'should be subclassable' do
33
34
  place = Class.new(GeoRuby::SimpleFeatures::Point)
34
- p = place.from_x_y(1,2)
35
+ p = place.from_x_y(1, 2)
35
36
  expect(p).to be_a place
36
37
  end
37
38
 
38
- it "should have binary_geometry_type 2" do
39
+ it 'should have binary_geometry_type 2' do
39
40
  expect(point.binary_geometry_type).to eql(1)
40
41
  end
41
42
 
42
- it "should have the correct srid" do
43
+ it 'should have the correct srid' do
43
44
  expect(point.srid).to eql(4326)
44
45
  end
45
46
 
46
- it "should not have z or m" do
47
+ it 'should not have z or m' do
47
48
  expect(point.with_z).to be_falsey
48
49
  expect(point).not_to be_with_z
49
50
  expect(point.with_m).to be_falsey
50
51
  expect(point).not_to be_with_m
51
52
  end
52
53
 
53
- it "should set params to 0.0" do
54
+ it 'should set params to 0.0' do
54
55
  expect(point.x).to eql(0.0)
55
56
  expect(point.y).to eql(0.0)
56
57
  expect(point.z).to eql(0.0)
57
58
  expect(point.m).to eql(0.0)
58
59
  end
59
60
 
60
- it "should compare ok" do
61
- point1= GeoRuby::SimpleFeatures::Point::new
62
- point1.set_x_y(1.5,45.4)
63
- point2= GeoRuby::SimpleFeatures::Point::new
64
- point2.set_x_y(1.5,45.4)
65
- point3= GeoRuby::SimpleFeatures::Point::new
66
- point3.set_x_y(4.5,12.3)
67
- point4= GeoRuby::SimpleFeatures::Point::new
68
- point4.set_x_y_z(1.5,45.4,423)
69
- point5= GeoRuby::SimpleFeatures::Point::new
70
- point5.set_x_y(1.5,45.4)
71
- point5.m=15
72
- geometry= GeoRuby::SimpleFeatures::Geometry::new
61
+ it 'should compare ok' do
62
+ point1 = GeoRuby::SimpleFeatures::Point.new
63
+ point1.set_x_y(1.5, 45.4)
64
+ point2 = GeoRuby::SimpleFeatures::Point.new
65
+ point2.set_x_y(1.5, 45.4)
66
+ point3 = GeoRuby::SimpleFeatures::Point.new
67
+ point3.set_x_y(4.5, 12.3)
68
+ point4 = GeoRuby::SimpleFeatures::Point.new
69
+ point4.set_x_y_z(1.5, 45.4, 423)
70
+ point5 = GeoRuby::SimpleFeatures::Point.new
71
+ point5.set_x_y(1.5, 45.4)
72
+ point5.m = 15
73
+ geometry = GeoRuby::SimpleFeatures::Geometry.new
73
74
 
74
75
  expect(point1).to eq(point2)
75
76
  expect(point1).not_to eq(point3)
@@ -78,45 +79,45 @@ describe GeoRuby::SimpleFeatures::Point do
78
79
  expect(point1).not_to eq(geometry)
79
80
  end
80
81
 
81
- describe "> Instantiation" do
82
+ describe '> Instantiation' do
82
83
 
83
- it "should instantiate a 2d point" do
84
- point = GeoRuby::SimpleFeatures::Point.from_x_y(10,20,123)
84
+ it 'should instantiate a 2d point' do
85
+ point = GeoRuby::SimpleFeatures::Point.from_x_y(10, 20, 123)
85
86
  expect(point.x).to eql(10)
86
87
  expect(point.y).to eql(20)
87
88
  expect(point.srid).to eql(123)
88
89
  expect(point.z).to eql(0.0)
89
90
  end
90
91
 
91
- it "should instantiate a 2d easily" do
92
- point = GeoRuby::SimpleFeatures::Point.xy(10,20,123)
92
+ it 'should instantiate a 2d easily' do
93
+ point = GeoRuby::SimpleFeatures::Point.xy(10, 20, 123)
93
94
  expect(point.x).to eql(10)
94
95
  expect(point.y).to eql(20)
95
96
  expect(point.srid).to eql(123)
96
97
  end
97
98
 
98
- it "should instantiate a 3d point" do
99
- point = GeoRuby::SimpleFeatures::Point.from_x_y_z(-10,-20,-30)
99
+ it 'should instantiate a 3d point' do
100
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_z(-10, -20, -30)
100
101
  expect(point.x).to eql(-10)
101
102
  expect(point.y).to eql(-20)
102
103
  expect(point.z).to eql(-30)
103
104
  end
104
105
 
105
- it "should store correctly a 3d point" do
106
- point = GeoRuby::SimpleFeatures::Point.from_x_y_z(-10,-20,-30)
106
+ it 'should store correctly a 3d point' do
107
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_z(-10, -20, -30)
107
108
  expect(point.to_coordinates).to eq([-10, -20, -30])
108
109
  end
109
110
 
110
- it "should instantiate a 3d(m) point" do
111
- point = GeoRuby::SimpleFeatures::Point.from_x_y_m(10,20,30)
111
+ it 'should instantiate a 3d(m) point' do
112
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_m(10, 20, 30)
112
113
  expect(point.x).to eql(10)
113
114
  expect(point.y).to eql(20)
114
115
  expect(point.m).to eql(30)
115
116
  expect(point.z).to eql(0.0)
116
117
  end
117
118
 
118
- it "should instantiate a 4d point" do
119
- point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(10,20,30,40,123)
119
+ it 'should instantiate a 4d point' do
120
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(10, 20, 30, 40, 123)
120
121
  expect(point.x).to eql(10)
121
122
  expect(point.y).to eql(20)
122
123
  expect(point.z).to eql(30)
@@ -124,20 +125,20 @@ describe GeoRuby::SimpleFeatures::Point do
124
125
  expect(point.srid).to eql(123)
125
126
  end
126
127
 
127
- it "should store correctly a 4d point" do
128
- point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(-10,-20,-30, 1)
128
+ it 'should store correctly a 4d point' do
129
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(-10, -20, -30, 1)
129
130
  expect(point.m).to eql(1)
130
- expect(point.to_coordinates).to eq([-10, -20, -30])
131
+ expect(point.to_coordinates).to eq([-10, -20, -30, 1])
131
132
  end
132
133
 
133
- it "should instantiate a point from polar coordinates" do
134
- point = GeoRuby::SimpleFeatures::Point.from_r_t(1.4142,45)
134
+ it 'should instantiate a point from polar coordinates' do
135
+ point = GeoRuby::SimpleFeatures::Point.from_r_t(1.4142, 45)
135
136
  expect(point.y).to be_within(0.1).of(1)
136
137
  expect(point.x).to be_within(0.1).of(1)
137
138
  end
138
139
 
139
- it "should instantiate from coordinates x,y" do
140
- point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6,2.8],123)
140
+ it 'should instantiate from coordinates x,y' do
141
+ point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6, 2.8], 123)
141
142
  expect(point.x).to eql(1.6)
142
143
  expect(point.y).to eql(2.8)
143
144
  expect(point).not_to be_with_z
@@ -145,8 +146,8 @@ describe GeoRuby::SimpleFeatures::Point do
145
146
  expect(point.srid).to eql(123)
146
147
  end
147
148
 
148
- it "should instantiate from coordinates x,y,z" do
149
- point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6,2.8,3.4],123, true)
149
+ it 'should instantiate from coordinates x,y,z' do
150
+ point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6, 2.8, 3.4], 123, true)
150
151
  expect(point.x).to eql(1.6)
151
152
  expect(point.y).to eql(2.8)
152
153
  expect(point.z).to eql(3.4)
@@ -154,8 +155,8 @@ describe GeoRuby::SimpleFeatures::Point do
154
155
  expect(point.srid).to eql(123)
155
156
  end
156
157
 
157
- it "should instantiate from coordinates x,y,z,m" do
158
- point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6,2.8,3.4,15],123, true, true)
158
+ it 'should instantiate from coordinates x,y,z,m' do
159
+ point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6, 2.8, 3.4, 15], 123, true, true)
159
160
  expect(point.x).to eql(1.6)
160
161
  expect(point.y).to eql(2.8)
161
162
  expect(point.z).to eql(3.4)
@@ -165,202 +166,207 @@ describe GeoRuby::SimpleFeatures::Point do
165
166
  expect(point.srid).to eql(123)
166
167
  end
167
168
 
168
- it "should have a bbox" do
169
- bbox = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(-1.6,2.8,-3.4,15,123).bounding_box
169
+ it 'should have a bbox' do
170
+ bbox = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(-1.6, 2.8, -3.4, 15, 123).bounding_box
170
171
  expect(bbox.length).to eql(2)
171
- expect(bbox[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6,2.8,-3.4))
172
- expect(bbox[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6,2.8,-3.4))
172
+ expect(bbox[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6, 2.8, -3.4))
173
+ expect(bbox[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6, 2.8, -3.4))
173
174
  end
174
175
 
175
- it "should parse lat long" do
176
- expect(GeoRuby::SimpleFeatures::Point.from_latlong("-20° 47' 26.37","-20° 47' 26.37").x).to be_within(0.00001).of(-20.790658)
177
- expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.378","20° 47' 26.378").y).to be_within(0.00001).of(20.790658)
176
+ it 'should parse lat long' do
177
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("-20° 47' 26.37", "-20° 47' 26.37").x).to be_within(0.00001).of(-20.790658)
178
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.378", "20° 47' 26.378").y).to be_within(0.00001).of(20.790658)
178
179
  end
179
180
 
180
- it "should parse lat long w/o sec" do
181
- expect(GeoRuby::SimpleFeatures::Point.from_latlong("-20°47′26″","-20°47′26″").x).to be_within(0.00001).of(-20.790555)
182
- expect(GeoRuby::SimpleFeatures::Point.from_latlong("20°47′26″","20°47′26″").y).to be_within(0.00001).of(20.790555)
181
+ it 'should parse lat long w/o sec' do
182
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong('-20°47′26″', '-20°47′26″').x).to be_within(0.00001).of(-20.790555)
183
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong('20°47′26″', '20°47′26″').y).to be_within(0.00001).of(20.790555)
183
184
  end
184
185
 
185
- it "should accept with W or S notation" do
186
- expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W","20° 47' 26.37 S").x).to be_within(0.00001).of(-20.790658)
187
- expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W","20° 47' 26.37 S").y).to be_within(0.00001).of(-20.790658)
186
+ it 'should accept with W or S notation' do
187
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W", "20° 47' 26.37 S").x).to be_within(0.00001).of(-20.790658)
188
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W", "20° 47' 26.37 S").y).to be_within(0.00001).of(-20.790658)
188
189
  end
189
190
 
190
- it "should instantiate a point from positive degrees" do
191
- point = GeoRuby::SimpleFeatures::Point.from_latlong('47`20 06.09E','22`50 77.35N')
191
+ it 'should instantiate a point from positive degrees' do
192
+ point = GeoRuby::SimpleFeatures::Point.from_latlong('47`20 06.09E', '22`50 77.35N')
192
193
  expect(point.y).to be_within(0.000001).of(22.8548194)
193
194
  expect(point.x).to be_within(0.000001).of(47.335025)
194
195
  end
195
196
 
196
- it "should instantiate a point from negative degrees" do
197
- point = GeoRuby::SimpleFeatures::Point.from_latlong('47`20 06.09W','22`50 77.35S')
197
+ it 'should instantiate a point from negative degrees' do
198
+ point = GeoRuby::SimpleFeatures::Point.from_latlong('47`20 06.09W', '22`50 77.35S')
198
199
  expect(point.y).to be_within(0.000001).of(-22.8548194)
199
200
  expect(point.x).to be_within(0.000001).of(-47.335025)
200
201
  end
201
202
 
202
- it "should print out nicely" do
203
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.88, -20.1).as_latlong).to eql("47°52′48″, -20°06′00″")
203
+ it 'should print out nicely' do
204
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.88, -20.1).as_latlong).to eql('47°52′48″, -20°06′00″')
204
205
  end
205
206
 
206
- it "should print out nicely latlong" do
207
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-20.78, 20.78).as_latlong(:full => true)).to eql("-20°46′48.00″, 20°46′48.00″")
207
+ it 'should print out nicely latlong' do
208
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-20.78, 20.78).as_latlong(full: true)).to eql('-20°46′48.00″, 20°46′48.00″')
208
209
  end
209
210
 
210
- it "should print out nicely latlong" do
211
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(:full => true)).to eql("47°06′36.00″, -20°11′60.00″")
211
+ it 'should print out nicely latlong' do
212
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(full: true)).to eql('47°06′36.00″, -20°11′60.00″')
212
213
  end
213
214
 
214
- it "should print out nicely latlong" do
215
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(:coord => true)).to eql("47°06′36″N, 20°11′60″W")
215
+ it 'should print out nicely latlong' do
216
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(coord: true)).to eql('47°06′36″N, 20°11′60″W')
216
217
  end
217
218
 
218
- it "should print out nicely latlong" do
219
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_latlong(:full => true,:coord => true)).to eql("47°06′36.00″S, 20°11′60.00″E")
219
+ it 'should print out nicely latlong' do
220
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_latlong(full: true, coord: true)).to eql('47°06′36.00″S, 20°11′60.00″E')
220
221
  end
221
222
 
222
- it "should print out nicely lat" do
223
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat).to eql("-47°06′36″")
223
+ it 'should print out nicely lat' do
224
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat).to eql('-47°06′36″')
224
225
  end
225
226
 
226
- it "should print out nicely lat with opts" do
227
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(:full => true)).to eql("-47°06′36.00″")
227
+ it 'should print out nicely lat with opts' do
228
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(full: true)).to eql('-47°06′36.00″')
228
229
  end
229
230
 
230
- it "should print out nicely lat with opts" do
231
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(:full => true,:coord => true)).to eql("47°06′36.00″S")
231
+ it 'should print out nicely lat with opts' do
232
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(full: true, coord: true)).to eql('47°06′36.00″S')
232
233
  end
233
234
 
234
- it "should print out nicely long" do
235
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long).to eql("20°11′60″")
235
+ it 'should print out nicely long' do
236
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long).to eql('20°11′60″')
236
237
  end
237
238
 
238
- it "should print out nicely long with opts" do
239
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(:full => true)).to eql("20°11′60.00″")
239
+ it 'should print out nicely long with opts' do
240
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(full: true)).to eql('20°11′60.00″')
240
241
  end
241
242
 
242
- it "should print out nicely long with opts" do
243
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(:full => true,:coord => true)).to eql("20°11′60.00″E")
243
+ it 'should print out nicely long with opts' do
244
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(full: true, coord: true)).to eql('20°11′60.00″E')
244
245
  end
245
246
 
246
247
  end
247
248
 
248
- describe " > Distance & Bearing" do
249
+ describe ' > Distance & Bearing' do
249
250
 
250
- let(:p1) { GeoRuby::SimpleFeatures::Point.from_x_y(1,1) }
251
- let(:p2) { GeoRuby::SimpleFeatures::Point.from_x_y(2,2) }
251
+ let(:p1) { GeoRuby::SimpleFeatures::Point.from_x_y(1, 1) }
252
+ let(:p2) { GeoRuby::SimpleFeatures::Point.from_x_y(2, 2) }
252
253
 
253
- it "and a 3th grade child should calculate euclidian distance" do
254
- expect(p1.euclidian_distance(p2)).
255
- to be_within(0.00000001).of(1.4142135623731)
254
+ it 'and a 3th grade child should calculate euclidian distance' do
255
+ expect(p1.euclidian_distance(p2))
256
+ .to be_within(0.00000001).of(1.4142135623731)
256
257
  end
257
258
 
258
- it "should calculate spherical distance" do
259
- expect(p1.spherical_distance(p2)).
260
- to be_within(0.00000001).of(157225.358003181)
259
+ it 'should calculate spherical distance' do
260
+ expect(p1.spherical_distance(p2))
261
+ .to be_within(0.00000001).of(157_225.358003181)
261
262
  end
262
263
 
263
- it "should calculate ellipsoidal distance" do
264
- expect(p1.ellipsoidal_distance(p2)).
265
- to be_within(0.00000001).of(156876.149400742)
264
+ it 'should calculate ellipsoidal distance' do
265
+ expect(p1.ellipsoidal_distance(p2))
266
+ .to be_within(0.00000001).of(156_876.149400742)
266
267
  end
267
268
 
268
- describe "Orthogonal Distance" do
269
- let(:line) { GeoRuby::SimpleFeatures::LineString.from_coordinates([[0,0],[1,3]], 4326) }
270
- let(:line2) { GeoRuby::SimpleFeatures::LineString.from_coordinates([[1,1],[1,2]], 4326) }
269
+ describe 'Orthogonal Distance' do
270
+
271
+ let(:line) { GeoRuby::SimpleFeatures::LineString.from_coordinates([[0, 0], [1, 3]], 4326) }
272
+ let(:line2) { GeoRuby::SimpleFeatures::LineString.from_coordinates([[1, 1], [1, 2]], 4326) }
271
273
 
272
- it "should calcula orthogonal distance from a line (90 deg)" do
274
+ it 'should calcula orthogonal distance from a line (90 deg)' do
273
275
  expect(p1.orthogonal_distance(line)).to be_within(0.001).of(1.414)
274
276
  end
275
277
 
276
- it "should calcula orthogonal distance very close..." do
278
+ it 'should calcula orthogonal distance very close...' do
277
279
  expect(p1.orthogonal_distance(line2)).to be_zero
278
280
  end
279
281
 
280
- it "should calcula orthogonal distance from a line (90 deg)" do
282
+ it 'should calcula orthogonal distance from a line (90 deg)' do
281
283
  expect(p2.orthogonal_distance(line)).to be_within(0.001).of(2.828)
282
284
  end
283
285
 
284
- it "should calcula orthogonal distance from a line (0 deg)" do
286
+ it 'should calcula orthogonal distance from a line (0 deg)' do
285
287
  expect(p2.orthogonal_distance(line2)).to be_within(0.1).of(1.0)
286
288
  end
287
289
 
288
- it "should calcula orthogonal distance from a line (0 deg)" do
290
+ it 'should calcula orthogonal distance from a line (0 deg)' do
289
291
  expect(p2.orthogonal_distance(line2)).to be_within(0.1).of(1.0)
290
292
  end
291
293
 
292
294
  end
293
295
 
294
- it "should calculate the bearing from apoint to another in degrees" do
295
- expect(p1.bearing_to(p2)).to be_within(0.01).of(45.0)
296
- end
296
+ describe 'Bearing' do
297
297
 
298
- it "should calculate the bearing from apoint to another in degrees" do
299
- p3 = GeoRuby::SimpleFeatures::Point.from_x_y(1,-1)
300
- expect(p1.bearing_to(p3)).to be_within(0.01).of(180.0)
301
- end
298
+ it 'should calculate the bearing from apoint to another in degrees' do
299
+ expect(p1.bearing_to(p2)).to be_within(0.01).of(45.0)
300
+ end
302
301
 
303
- it "should calculate the bearing from apoint to another in degrees" do
304
- p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1,-1)
305
- expect(p1.bearing_to(p3)).to be_within(0.01).of(225.0)
306
- end
302
+ it 'should calculate the bearing from apoint to another in degrees' do
303
+ p3 = GeoRuby::SimpleFeatures::Point.from_x_y(1, -1)
304
+ expect(p1.bearing_to(p3)).to be_within(0.01).of(180.0)
305
+ end
307
306
 
308
- it "should calculate the bearing from apoint to another in degrees" do
309
- p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1,1)
310
- expect(p1.bearing_to(p3)).to be_within(0.01).of(270.0)
311
- end
307
+ it 'should calculate the bearing from apoint to another in degrees' do
308
+ p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1, -1)
309
+ expect(p1.bearing_to(p3)).to be_within(0.01).of(225.0)
310
+ end
312
311
 
313
- it "should calculate the bearing from apoint to another in degrees" do
314
- p3 = GeoRuby::SimpleFeatures::Point.from_x_y(2,-1)
315
- expect(p1.bearing_to(p3)).to be_within(0.0001).of(153.4349488)
316
- end
312
+ it 'should calculate the bearing from apoint to another in degrees' do
313
+ p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1, 1)
314
+ expect(p1.bearing_to(p3)).to be_within(0.01).of(270.0)
315
+ end
317
316
 
318
- it "should calculate a clone point bearing to 0" do
319
- expect(p1.bearing_to(p1)).to eql(0)
320
- end
317
+ it 'should calculate the bearing from apoint to another in degrees' do
318
+ p3 = GeoRuby::SimpleFeatures::Point.from_x_y(2, -1)
319
+ expect(p1.bearing_to(p3)).to be_within(0.0001).of(153.4349488)
320
+ end
321
321
 
322
- it "should calculate the bearing from apoint to another in degrees" do
323
- expect(p1.bearing_text(p2)).to eql(:ne)
324
- end
322
+ it 'should calculate a clone point bearing to 0' do
323
+ expect(p1.bearing_to(p1)).to eql(0)
324
+ end
325
+
326
+ it 'should calculate the bearing from apoint to another in degrees' do
327
+ expect(p1.bearing_text(p2)).to eql(:ne)
328
+ end
329
+
330
+ it 'should calculate the bearing from apoint to another in degrees' do
331
+ p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1, 1)
332
+ expect(p1.bearing_text(p3)).to eql(:w)
333
+ end
325
334
 
326
- it "should calculate the bearing from apoint to another in degrees" do
327
- p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1,1)
328
- expect(p1.bearing_text(p3)).to eql(:w)
329
335
  end
330
336
 
331
337
  end
332
338
 
333
- describe "> Export Formats" do
339
+ describe '> Export Formats' do
334
340
 
335
- let(:point) { GeoRuby::SimpleFeatures::Point.from_x_y( -11.2431, 32.3141 ) }
341
+ let(:point) { GeoRuby::SimpleFeatures::Point.from_x_y(-11.2431, 32.3141) }
336
342
 
337
- it "should print out as array" do
343
+ it 'should print out as array' do
338
344
 
339
345
  end
340
346
 
341
- it "should print nicely" do
342
- expect(point.text_representation).to eql("-11.2431 32.3141")
347
+ it 'should print nicely' do
348
+ expect(point.text_representation).to eql('-11.2431 32.3141')
343
349
  end
344
350
 
345
- it "should printoout as binary" do
346
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3,123).as_hex_ewkb).to eql("01010000207B000000CDCCCCCCCCCC28406666666666A64640")
347
- point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(12.4,45.3,-3.5,15,123)
348
- expect(point.as_hex_ewkb).to eql("01010000E07B000000CDCCCCCCCCCC28406666666666A646400000000000000CC00000000000002E40")
349
- expect(point.as_hex_wkb).to eql("0101000000CDCCCCCCCCCC28406666666666A64640")
351
+ it 'should printoout as binary' do
352
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(12.4, 45.3, 123).as_hex_ewkb).to eql('01010000207B000000CDCCCCCCCCCC28406666666666A64640')
353
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(12.4, 45.3, -3.5, 15, 123)
354
+ expect(point.as_hex_ewkb).to eql('01010000E07B000000CDCCCCCCCCCC28406666666666A646400000000000000CC00000000000002E40')
355
+ expect(point.as_hex_wkb).to eql('0101000000CDCCCCCCCCCC28406666666666A64640')
350
356
  end
351
357
 
352
- it "should printoout as text" do
353
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3,123).as_ewkt).to eql("SRID=123;POINT(12.4 45.3)")
354
- point = GeoRuby::SimpleFeatures::Point.from_x_y_z(12.4,45.3,-3.5,123)
355
- expect(point.as_ewkt).to eql("SRID=123;POINT(12.4 45.3 -3.5)")
356
- expect(point.as_wkt).to eql("POINT(12.4 45.3)")
357
- expect(point.as_ewkt(false,true)).to eql("POINT(12.4 45.3 -3.5)")
358
- point = GeoRuby::SimpleFeatures::Point.from_x_y_m(12.4,45.3,-3.5,123)
359
- expect(point.as_ewkt).to eql("SRID=123;POINTM(12.4 45.3 -3.5)")
360
- expect(point.as_ewkt(true,true,false)).to eql("SRID=123;POINT(12.4 45.3)")
358
+ it 'should printoout as text' do
359
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(12.4, 45.3, 123).as_ewkt).to eql('SRID=123;POINT(12.4 45.3)')
360
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_z(12.4, 45.3, -3.5, 123)
361
+ expect(point.as_ewkt).to eql('SRID=123;POINT(12.4 45.3 -3.5)')
362
+ expect(point.as_wkt).to eql('POINT(12.4 45.3)')
363
+ expect(point.as_ewkt(false, true)).to eql('POINT(12.4 45.3 -3.5)')
364
+ point = GeoRuby::SimpleFeatures::Point.from_x_y_m(12.4, 45.3, -3.5, 123)
365
+ expect(point.as_ewkt).to eql('SRID=123;POINTM(12.4 45.3 -3.5)')
366
+ expect(point.as_ewkt(true, true, false)).to eql('SRID=123;POINT(12.4 45.3)')
361
367
  end
362
368
 
363
- it "should have a nice bounding box" do
369
+ it 'should have a nice bounding box' do
364
370
  expect(point.bounding_box.size).to eq(2)
365
371
  point.bounding_box.each do |point|
366
372
  expect(point.x).to eql(point.x)
@@ -368,58 +374,58 @@ describe GeoRuby::SimpleFeatures::Point do
368
374
  end
369
375
  end
370
376
 
371
- it "should print as kml too" do
377
+ it 'should print as kml too' do
372
378
  expect(point.kml_representation).to eql("<Point>\n<coordinates>-11.2431,32.3141</coordinates>\n</Point>\n")
373
379
  end
374
380
 
375
- it "should print as html too" do
381
+ it 'should print as html too' do
376
382
  expect(point.html_representation).to eql("<span class='geo'><abbr class='latitude' title='-11.2431'>11°14′35″S</abbr><abbr class='longitude' title='32.3141'>32°18′51″E</abbr></span>")
377
383
  end
378
384
 
379
- it "should print as html too with opts" do
385
+ it 'should print as html too with opts' do
380
386
  expect(point.html_representation(coord: false)).to eql("<span class='geo'><abbr class='latitude' title='-11.2431'>-11°14′35″</abbr><abbr class='longitude' title='32.3141'>32°18′51″</abbr></span>")
381
387
  end
382
388
 
383
- it "should print as html too with opts" do
389
+ it 'should print as html too with opts' do
384
390
  expect(point.html_representation(full: true)).to eql("<span class='geo'><abbr class='latitude' title='-11.2431'>11°14′35.16″S</abbr><abbr class='longitude' title='32.3141'>32°18′50.76″E</abbr></span>")
385
391
  end
386
392
 
387
- it "should print as georss" do
388
- expect(point.georss_simple_representation(:georss_ns => 'hey')).to eql("<hey:point>32.3141 -11.2431</hey:point>\n")
393
+ it 'should print as georss' do
394
+ expect(point.georss_simple_representation(georss_ns: 'hey')).to eql("<hey:point>32.3141 -11.2431</hey:point>\n")
389
395
  end
390
396
 
391
- it "should print r (polar coords)" do
397
+ it 'should print r (polar coords)' do
392
398
  expect(point.r).to be_within(0.000001).of(34.214154)
393
399
  end
394
400
 
395
- it "should print theta as degrees" do
401
+ it 'should print theta as degrees' do
396
402
  expect(point.theta_deg).to be_within(0.0001).of(289.184406352127)
397
403
  end
398
404
 
399
- it "should print theta as radians" do
405
+ it 'should print theta as radians' do
400
406
  expect(point.theta_rad).to be_within(0.0001).of(5.04722003626982)
401
407
  end
402
408
 
403
- it "should print theta when x is zero y > 0" do
409
+ it 'should print theta when x is zero y > 0' do
404
410
  pt = GeoRuby::SimpleFeatures::Point.from_x_y(0.0, 32.3141)
405
411
  expect(pt.theta_rad).to be_within(0.0001).of(1.5707963267948966)
406
412
  end
407
413
 
408
- it "should print theta when x is zero y < 0" do
414
+ it 'should print theta when x is zero y < 0' do
409
415
  pt = GeoRuby::SimpleFeatures::Point.from_x_y(0.0, -32.3141)
410
416
  expect(pt.theta_rad).to be_within(0.0001).of(4.71238898038469)
411
417
  end
412
418
 
413
- it "should output as polar" do
419
+ it 'should output as polar' do
414
420
  expect(point.as_polar).to be_instance_of(Array)
415
- expect(point.as_polar.size).to eq(2) #.length.should eql(2)
421
+ expect(point.as_polar.size).to eq(2) # .length.should eql(2)
416
422
  end
417
423
 
418
- it "should print out nicely as json/geojson" do
419
- expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_json).to eql({:type=>"Point", :coordinates=>[-47.11, 20.2]})
424
+ it 'should print out nicely as json/geojson' do
425
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_json).to eql(type: 'Point', coordinates: [-47.11, 20.2])
420
426
  end
421
427
 
422
- it "should print out nicely to json/geojson" do
428
+ it 'should print out nicely to json/geojson' do
423
429
  expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).to_json).to eql("{\"type\":\"Point\",\"coordinates\":[-47.11,20.2]}")
424
430
  end
425
431