s2_cells 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dad811983bcc19ff4a8c5d785355724345b4c87f
4
+ data.tar.gz: 68ea64c7a0c721e72b3ee55273fcdcc542a7a487
5
+ SHA512:
6
+ metadata.gz: 3f138bc4a2320eccc711cbe74565a5b70ced7ea9071988d4c88e9b279c39d432e728660fbac919cea57a4a28d6a592e9108729d45801cdc1b2575d9843dcc8e8
7
+ data.tar.gz: 1e9d46ce2104e6bb2465220106e2ba5177b952723e412b4398ff4bcacb250874de8b947b934f5dc4008177b6a2a87d5f511f004032068c5a1e9c58d76c36e065
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,74 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ DisplayCopNames: true
4
+ DisplayStyleGuide: true
5
+ Exclude:
6
+ - '*.gemspec'
7
+
8
+ Style/RegexpLiteral:
9
+ Exclude:
10
+ - 'Guardfile'
11
+
12
+ # We deal with s2 cell ids and geo hashes.
13
+ # Doesn't make sense to use this cop.
14
+ Style/NumericLiterals:
15
+ Enabled: false
16
+
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
19
+ # Include: **/Gemfile, **/gems.rb
20
+ Bundler/OrderedGems:
21
+ AutoCorrect: true
22
+
23
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
24
+ # URISchemes: http, https
25
+ Metrics/LineLength:
26
+ AllowHeredoc: true
27
+ AllowURI: true
28
+ IgnoredPatterns: true
29
+ Max: 100
30
+
31
+ # Sometimes we have portuguese in the comments
32
+ Style/AsciiComments:
33
+ Enabled: false
34
+
35
+ Style/Documentation:
36
+ Enabled: false
37
+ # Exclude:
38
+ # - 'spec/**/*'
39
+ # - 'test/**/*'
40
+
41
+ # Cop supports --auto-correct.
42
+ Style/EmptyLineAfterMagicComment:
43
+ AutoCorrect: true
44
+ Exclude:
45
+ - 'Gemfile'
46
+
47
+ Style/ParallelAssignment:
48
+ Enabled: false
49
+
50
+ # Cop supports --auto-correct.
51
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
52
+ # SupportedStyles: space, no_space, compact
53
+ # SupportedStylesForEmptyBraces: space, no_space
54
+ Style/SpaceInsideHashLiteralBraces:
55
+ AutoCorrect: true
56
+ EnforcedStyle: no_space
57
+
58
+ # Cop supports --auto-correct.
59
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
60
+ # SupportedStyles: single_quotes, double_quotes
61
+ Style/StringLiterals:
62
+ EnforcedStyle: double_quotes
63
+
64
+ # Cop supports --auto-correct.
65
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
66
+ # SupportedStyles: final_newline, final_blank_line
67
+ Style/TrailingBlankLines:
68
+ AutoCorrect: true
69
+
70
+ # Arrows make more sense for Rakefile
71
+ # as it denotes dependency
72
+ Style/HashSyntax:
73
+ Exclude:
74
+ - 'Rakefile'
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.14.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ronie.uliana@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in s2_cells.gemspec
6
+ gemspec
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A sample Guardfile
4
+ # More info at https://github.com/guard/guard#readme
5
+
6
+ ## Uncomment and set this to only include directories you want to watch
7
+ # directories %w(app lib config test spec features) \
8
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
9
+
10
+ ## Note: if you are using the `directories` clause above and you are not
11
+ ## watching the project directory ('.'), then you will want to move
12
+ ## the Guardfile to a watched dir and symlink it back, e.g.
13
+ #
14
+ # $ mkdir config
15
+ # $ mv Guardfile config/
16
+ # $ ln -s config/Guardfile .
17
+ #
18
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
19
+
20
+ group :tdd, halt_on_fail: true do
21
+ guard :minitest,
22
+ cmd: "bundle exec rspec -f documentation --color",
23
+ run_all: {cmd: "bundle exec rspec -f documentation --color"},
24
+ keep: true,
25
+ all_on_start: true,
26
+ all_after_pass: true do
27
+
28
+ watch(%r{^test/(.*)\/?test_(.*)\.rb$})
29
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
30
+ watch(%r{^test/test_helper\.rb$}) { "test" }
31
+ end
32
+
33
+ guard :rubocop, cmd: "bundle exec rubocop", cli: "-fs -c./.rubocop.yml" do
34
+ watch(%r{.+\.rb$})
35
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Ronie Uliana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ # S2Cells
2
+
3
+ Simple S2 Cells for Ruby.
4
+
5
+ The main use (at the time of this writing) is to map Lat Long to S2 Cells in different levels.
6
+
7
+ The code was initially copied from another lib in Ruby (https://github.com/nabeelamjad/poke-api), but we are moving the code forward as we work on it.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 's2_cells'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install s2_cells
24
+
25
+ ## Usage
26
+
27
+ Basic usage:
28
+
29
+ ```ruby
30
+ S2LatLon.new(-23.54719302, -46.55451921).to_s2_id(12)
31
+ # => -7724132475764473856
32
+ ```
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/s2_cells. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
43
+
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
48
+
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task :default => :test
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "s2_cells"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "s2_cells/version"
4
+
5
+ module S2Cells
6
+ end
7
+
8
+ require "s2_cells/s2_cell_base"
9
+ require "s2_cells/s2_point"
10
+ require "s2_cells/s2_cell_id"
11
+ require "s2_cells/s2_lat_lon"
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module S2Cells
4
+ module S2Base
5
+ LINEAR_PROJECTION = 0
6
+ TAN_PROJECTION = 1
7
+ QUADRATIC_PROJECTION = 2
8
+
9
+ MAX_LEVEL = 30
10
+ NUM_FACES = 6
11
+ POS_BITS = 2 * MAX_LEVEL + 1
12
+ MAX_SIZE = 1 << MAX_LEVEL
13
+ SWAP_MASK = 0x01
14
+ INVERT_MASK = 0x02
15
+ LOOKUP_BITS = 4
16
+ POS_TO_OR = [SWAP_MASK, 0, 0, INVERT_MASK | SWAP_MASK].freeze
17
+ POS_TO_IJ = [[0, 1, 3, 2],
18
+ [0, 2, 3, 1],
19
+ [3, 2, 0, 1],
20
+ [3, 1, 0, 2]].freeze
21
+
22
+ LOOKUP_POS = [nil] * (1 << (2 * LOOKUP_BITS + 2))
23
+ LOOKUP_IJ = [nil] * (1 << (2 * LOOKUP_BITS + 2))
24
+
25
+ def self.lookup_cells(level, i, j, orig_orientation, pos, orientation)
26
+ return lookup_bits(i, j, orig_orientation, pos, orientation) if level == LOOKUP_BITS
27
+
28
+ r = POS_TO_IJ[orientation]
29
+ 4.times do |index|
30
+ lookup_cells(
31
+ level + 1, (i << 1) + (r[index] >> 1), (j << 1) + (r[index] & 1),
32
+ orig_orientation, (pos << 2) + index, orientation ^ POS_TO_OR[index]
33
+ )
34
+ end
35
+ end
36
+
37
+ def self.lookup_bits(i, j, orig_orientation, pos, orientation)
38
+ ij = (i << LOOKUP_BITS) + j
39
+ LOOKUP_POS[(ij << 2) + orig_orientation] = (pos << 2) + orientation
40
+ LOOKUP_IJ[(pos << 2) + orig_orientation] = (ij << 2) + orientation
41
+ end
42
+
43
+ lookup_cells(0, 0, 0, 0, 0, 0)
44
+ lookup_cells(0, 0, 0, SWAP_MASK, 0, SWAP_MASK)
45
+ lookup_cells(0, 0, 0, INVERT_MASK, 0, INVERT_MASK)
46
+ lookup_cells(0, 0, 0, SWAP_MASK | INVERT_MASK, 0, SWAP_MASK | INVERT_MASK)
47
+ end
48
+ end
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ module S2Cells
4
+ class S2CellId
5
+ include S2Base
6
+ attr_reader :id
7
+
8
+ SIGNED_CONST = 2**64
9
+
10
+ def initialize(id)
11
+ @id = id
12
+ end
13
+
14
+ def signed_id
15
+ @id - SIGNED_CONST
16
+ end
17
+
18
+ def parent(level)
19
+ new_lsb = lsb_for_level(level)
20
+ s2 = S2CellId.new((@id & -new_lsb) | new_lsb)
21
+
22
+ raise Errors::InvalidLevel, level unless valid?(s2.id)
23
+ s2
24
+ end
25
+
26
+ def prev
27
+ S2CellId.new(@id - (lsb << 1))
28
+ end
29
+
30
+ def next
31
+ S2CellId.new(@id + (lsb << 1))
32
+ end
33
+
34
+ def level
35
+ return MAX_LEVEL if leaf?
36
+
37
+ x = (@id & 0xffffffff)
38
+ level = -1
39
+
40
+ if x != 0
41
+ level += 16
42
+ else
43
+ x = ((@id >> 32) & 0xffffffff)
44
+ end
45
+
46
+ x &= -x
47
+
48
+ level += 8 unless (x & 0x00005555).zero?
49
+ level += 4 unless (x & 0x00550055).zero?
50
+ level += 2 unless (x & 0x05050505).zero?
51
+ level += 1 unless (x & 0x11111111).zero?
52
+ level
53
+ end
54
+
55
+ def self.from_point(p)
56
+ face, u, v = xyz_to_face_uv(p)
57
+ i = st_to_ij(uv_to_st(u))
58
+ j = st_to_ij(uv_to_st(v))
59
+
60
+ S2CellId.new(from_face_ij(face, i, j))
61
+ end
62
+
63
+ def self.from_face_ij(face, i, j)
64
+ n = face << (POS_BITS - 1)
65
+ bits = face & SWAP_MASK
66
+
67
+ 7.downto(0).each do |k|
68
+ mask = (1 << LOOKUP_BITS) - 1
69
+ bits += (((i >> (k * LOOKUP_BITS)) & mask) << (LOOKUP_BITS + 2))
70
+ bits += (((j >> (k * LOOKUP_BITS)) & mask) << 2)
71
+ bits = LOOKUP_POS[bits]
72
+ n |= (bits >> 2) << (k * 2 * LOOKUP_BITS)
73
+ bits &= (SWAP_MASK | INVERT_MASK)
74
+ end
75
+
76
+ @id = (n * 2 + 1)
77
+ end
78
+
79
+ def self.xyz_to_face_uv(p)
80
+ face = p.largest_abs_component
81
+
82
+ pface = case face
83
+ when 0 then p.x
84
+ when 1 then p.y
85
+ else p.z
86
+ end
87
+
88
+ face += 3 if pface < 0
89
+
90
+ u, v = valid_face_xyz_to_uv(face, p)
91
+ [face, u, v]
92
+ end
93
+
94
+ def self.uv_to_st(u)
95
+ return 0.5 * Math.sqrt(1 + 3 * u) if u >= 0
96
+ 1 - 0.5 * Math.sqrt(1 - 3 * u)
97
+ end
98
+
99
+ def self.st_to_ij(s)
100
+ [0, [MAX_SIZE - 1, Integer((MAX_SIZE * s).floor)].min].max
101
+ end
102
+
103
+ def self.valid_face_xyz_to_uv(face, p)
104
+ raise unless p.dot_prod(face_uv_to_xyz(face, 0, 0)) > 0
105
+
106
+ case face
107
+ when 0 then [p.y / p.x, p.z / p.x]
108
+ when 1 then [-p.x / p.y, p.z / p.y]
109
+ when 2 then [-p.x / p.z, -p.y / p.z]
110
+ when 3 then [p.z / p.x, p.y / p.x]
111
+ when 4 then [p.z / p.y, -p.x / p.y]
112
+ else [-p.y / p.z, -p.x / p.z]
113
+ end
114
+ end
115
+
116
+ def self.face_uv_to_xyz(face, u, v)
117
+ case face
118
+ when 0 then S2Point.new(1, u, v)
119
+ when 1 then S2Point.new(-u, 1, v)
120
+ when 2 then S2Point.new(-u, -v, 1)
121
+ when 3 then S2Point.new(-1, -v, -u)
122
+ when 4 then S2Point.new(v, -1, -u)
123
+ else S2Point.new(v, u, -1)
124
+ end
125
+ end
126
+
127
+ private_class_method :face_uv_to_xyz, :valid_face_xyz_to_uv, :uv_to_st,
128
+ :st_to_ij, :xyz_to_face_uv, :from_face_ij
129
+
130
+ private
131
+
132
+ def leaf?
133
+ @id & 1 != 0
134
+ end
135
+
136
+ def valid?(s2_id)
137
+ face = s2_id >> POS_BITS
138
+ lsb = s2_id & -s2_id
139
+ (face < NUM_FACES) && (lsb & 0x1555555555555555) != 0
140
+ end
141
+
142
+ def lsb
143
+ @id & -@id
144
+ end
145
+
146
+ def lsb_for_level(level)
147
+ 1 << (2 * (MAX_LEVEL - level))
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module S2Cells
4
+ class S2LatLon
5
+ def initialize(lat_degrees, lon_degrees)
6
+ @lat = lat_degrees * Math::PI / 180
7
+ @lon = lon_degrees * Math::PI / 180
8
+ end
9
+
10
+ def to_point
11
+ phi = @lat
12
+ theta = @lon
13
+ cosphi = Math.cos(phi)
14
+ S2Point.new(Math.cos(theta) * cosphi, Math.sin(theta) * cosphi, Math.sin(phi))
15
+ end
16
+
17
+ def to_s2_id(level)
18
+ S2CellId.from_point(to_point)
19
+ .parent(level)
20
+ .signed_id
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module S2Cells
4
+ class S2Point
5
+ attr_reader :x, :y, :z
6
+
7
+ def initialize(x, y, z)
8
+ @x = x
9
+ @y = y
10
+ @z = z
11
+ end
12
+
13
+ def abs
14
+ [@x.abs, @y.abs, @z.abs]
15
+ end
16
+
17
+ def largest_abs_component
18
+ temp = abs
19
+
20
+ if temp[0] > temp[1]
21
+ temp[0] > temp[2] ? 0 : 2
22
+ else
23
+ temp[1] > temp[2] ? 1 : 2
24
+ end
25
+ end
26
+
27
+ def dot_prod(o)
28
+ @x * o.x + @y * o.y + @z * o.z
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module S2Cells
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "s2_cells/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "s2_cells"
9
+ spec.version = S2Cells::VERSION
10
+ spec.authors = ["Ronie Uliana"]
11
+ spec.email = ["ronie.uliana@gmail.com"]
12
+
13
+ spec.summary = %q{Lat Long to Google S2 Cells}
14
+ spec.description = %q{Converts latitude and longitude to Google S2 Cells. Useful for geo stuff. A better description of S2 cells can be found here: http://blog.christianperone.com/2015/08/googles-s2-geometry-on-the-sphere-cells-and-hilbert-curve/}
15
+ spec.homepage = ""
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.14"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "minitest", "~> 5.0"
28
+ spec.add_development_dependency "guard-minitest", "~> 2.4"
29
+ spec.add_development_dependency "rubocop", "~> 0.48"
30
+ spec.add_development_dependency "guard-rubocop", "~> 1.2"
31
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: s2_cells
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ronie Uliana
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-04-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.48'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.48'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.2'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.2'
97
+ description: 'Converts latitude and longitude to Google S2 Cells. Useful for geo stuff.
98
+ A better description of S2 cells can be found here: http://blog.christianperone.com/2015/08/googles-s2-geometry-on-the-sphere-cells-and-hilbert-curve/'
99
+ email:
100
+ - ronie.uliana@gmail.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rubocop.yml"
107
+ - ".travis.yml"
108
+ - CODE_OF_CONDUCT.md
109
+ - Gemfile
110
+ - Guardfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - lib/s2_cells.rb
117
+ - lib/s2_cells/s2_cell_base.rb
118
+ - lib/s2_cells/s2_cell_id.rb
119
+ - lib/s2_cells/s2_lat_lon.rb
120
+ - lib/s2_cells/s2_point.rb
121
+ - lib/s2_cells/version.rb
122
+ - s2_cells.gemspec
123
+ homepage: ''
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.6.11
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Lat Long to Google S2 Cells
147
+ test_files: []