terraformer 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/terraformer/circle.rb +1 -1
- data/lib/terraformer/feature.rb +9 -1
- data/lib/terraformer/geometry/class_methods.rb +2 -2
- data/lib/terraformer/version.rb +1 -1
- data/lib/terraformer.rb +6 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b6d98a81dc53659e7ba79e1e0f8aae6c7dcce0c
|
4
|
+
data.tar.gz: ae1703cfca4bf6dcd5274e6000e25ac49f2dbd4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 446017136b2d9bd276228652e630bce786c233730e98f696cbecaaf0a987dbd24e541b071418c4f3cfb58d67330ac2913e59400f2bc5f9c3ecd84a8e0e77dbe8
|
7
|
+
data.tar.gz: 40023cea07bffc3d300d243ce99b784564897a23882e7034c0409079e9ae3860daff59f7fb36a8ceffb9525aaf3ac7ed73f11bcc24f69c5f0d1c608539f363ff
|
data/lib/terraformer/circle.rb
CHANGED
@@ -4,7 +4,7 @@ module Terraformer
|
|
4
4
|
|
5
5
|
attr_accessor :polygon
|
6
6
|
attr_reader :center, :radius, :resolution
|
7
|
-
def_delegators :@polygon, :contains?, :within?, :intersects?, :to_feature, :to_json
|
7
|
+
def_delegators :@polygon, :contains?, :within?, :intersects?, :to_feature, :to_json, :to_hash
|
8
8
|
|
9
9
|
def initialize c, r, res = DEFAULT_BUFFER_RESOLUTION
|
10
10
|
self.center = c
|
data/lib/terraformer/feature.rb
CHANGED
@@ -37,6 +37,10 @@ module Terraformer
|
|
37
37
|
self.geometry.great_circle_distance other
|
38
38
|
end
|
39
39
|
|
40
|
+
def geojson_io
|
41
|
+
Terraformer.geojson_io self
|
42
|
+
end
|
43
|
+
|
40
44
|
end
|
41
45
|
|
42
46
|
class FeatureCollection < Primitive
|
@@ -53,7 +57,7 @@ module Terraformer
|
|
53
57
|
def initialize *args
|
54
58
|
unless args.empty?
|
55
59
|
super *args do |arg|
|
56
|
-
self.features = arg['features'].map {|f| Terraformer.parse f}
|
60
|
+
self.features = arg['features'].map {|f| Terraformer.parse f unless Primitive === f}
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
@@ -78,6 +82,10 @@ module Terraformer
|
|
78
82
|
ConvexHull.for features.map(&:geometry).map(&:coordinates)
|
79
83
|
end
|
80
84
|
|
85
|
+
def geojson_io
|
86
|
+
Terraformer.geojson_io self
|
87
|
+
end
|
88
|
+
|
81
89
|
end
|
82
90
|
|
83
91
|
end
|
@@ -48,10 +48,10 @@ module Terraformer
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
when b[0].class == Array
|
51
|
-
b.each {|e| return true if
|
51
|
+
b.each {|e| return true if arrays_intersect_arrays?(a, e)}
|
52
52
|
end
|
53
53
|
when a[0].class == Array
|
54
|
-
a.each {|e| return true if
|
54
|
+
a.each {|e| return true if arrays_intersect_arrays?(e, b)}
|
55
55
|
end
|
56
56
|
false
|
57
57
|
end
|
data/lib/terraformer/version.rb
CHANGED
data/lib/terraformer.rb
CHANGED
@@ -48,6 +48,11 @@ module Terraformer
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def self.geojson_io data
|
52
|
+
require 'launchy'
|
53
|
+
Launchy.open "http://geojson.io/#data=data:application/json,#{URI.encode_www_form_component data.to_json}"
|
54
|
+
end
|
55
|
+
|
51
56
|
class Primitive
|
52
57
|
|
53
58
|
def initialize *args
|
@@ -92,5 +97,6 @@ require 'terraformer/polygon'
|
|
92
97
|
require 'terraformer/multi_polygon'
|
93
98
|
require 'terraformer/convex_hull'
|
94
99
|
require 'terraformer/circle'
|
100
|
+
require 'terraformer/arcgis'
|
95
101
|
|
96
102
|
require 'terraformer/version'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraformer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email:
|
@@ -17,7 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
-
|
20
|
+
- .gitignore
|
21
21
|
- Gemfile
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
@@ -69,17 +69,17 @@ require_paths:
|
|
69
69
|
- lib
|
70
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- -
|
77
|
+
- - '>='
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.0.14
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: ''
|
@@ -100,3 +100,4 @@ test_files:
|
|
100
100
|
- test/helper.rb
|
101
101
|
- test/primitive_spec.rb
|
102
102
|
- test/terraformer_spec.rb
|
103
|
+
has_rdoc:
|