charta 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27a2e5f7689bcfa650af268dd6a6f0d8a62bdea6cc20fdc3b7e4b372d62205c8
4
- data.tar.gz: 39cb1fb8023d04d19e211323987dd2a80231e616e34c81134729e7b7a231fbf0
3
+ metadata.gz: 3bdf87fdffb17cf24b38fb76b86d84593bc3f6ca0d0d3e8ffcf5df3d76d3db1f
4
+ data.tar.gz: bda9a9fd027f0bfdb514a7de6e92429977dc55e5fe7db38c27f6a59a871df875
5
5
  SHA512:
6
- metadata.gz: ff3edbf296fe4736cd84da7a689ce5e2df6605aa1a181827b80bebc1e9d2131744b25bd491ebc180f946af615de60acba5f2463d2e97f1ab409f3d8fdb0c35fb
7
- data.tar.gz: 1c418aba1d2113235ad8886a425a1a8ab49120d1bea3bdfb4dd7d2476b45f4022da4ac7503e67f8a2dd1272182e9d11174f5119b94f02d3eedbc708f92896824
6
+ metadata.gz: a808aff9f3da978cd293d0084e9c2a61c7a414fe259ca71821ed195afc50f57e99b7d352e0651723dfa7379d70881dfbf01c4d2959e5602c121e94a78bf14b90
7
+ data.tar.gz: 54a3e3e081602b978bd4b60d9c8bbbf894d22e14b501715f34278ba48c4ee76489b29b92f2f51419ccb311cd046f9871865240565385b6f5848a63a2b257b09c
@@ -24,5 +24,9 @@ module Charta
24
24
  def to_a
25
25
  [[@y_min, @x_min], [@y_max, @x_max]]
26
26
  end
27
+
28
+ def to_bbox_string
29
+ "#{@x_min}, #{@y_min}, #{x_max}, #{y_max}"
30
+ end
27
31
  end
28
32
  end
@@ -10,5 +10,10 @@ module Charta
10
10
  feature.y
11
11
  end
12
12
  alias latitude y
13
+
14
+ def distance(point)
15
+ raise ArgumentError, "wrong type: Charta::Point required" if point.class.name != "Charta::Point"
16
+ to_rgeo.distance(point.to_rgeo)
17
+ end
13
18
  end
14
19
  end
@@ -8,5 +8,10 @@ module Charta
8
8
  end
9
9
  @exterior_ring
10
10
  end
11
+
12
+ def distance(point)
13
+ polygon_centroid = Charta.new_point(*centroid, 4326)
14
+ polygon_centroid.distance(point)
15
+ end
11
16
  end
12
17
  end
@@ -1,3 +1,3 @@
1
1
  module Charta
2
- VERSION = '0.1.16'.freeze
2
+ VERSION = '0.1.17'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice TEXIER