swedishgrid-cli 0.0.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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/swedishgrid +38 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e43b211c92a363548ab5907b484a129fd12ee8c4c9c06ce569577b2462774025
4
+ data.tar.gz: 4cd71b69ef131f6f3d191f55dc1b8529410383b6593c9aa4a9eda3bbeb0985a3
5
+ SHA512:
6
+ metadata.gz: 5af1f34e168961d4e87a50aca1c516a4b8dbff53cb054a2adec8298b783c53228ec0e32d0aaa1d265b4aabc1f623d5dea69374e93e9c8d58914ea1588647e21b
7
+ data.tar.gz: 689fa7148344522c8843940c3ced3bb26316e7169e33675ea8daeba6404b92c296fcd0bb4ea7bca8168f725e1aae6112a428f1633a3004e711676b72961ff13e
data/bin/swedishgrid ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'swedishgrid'
5
+
6
+ options = {}
7
+
8
+ OptionParser.new do |parser|
9
+
10
+ parser.on("-f rt90,sweref99tm", "--from", "From system type") do |v|
11
+ options[:from] = v
12
+ end
13
+
14
+ parser.on("-t grid,geodetic", "--to", "To format") do |v|
15
+ options[:to] = v
16
+ end
17
+
18
+ parser.on("-x N", Float, "x/latitude to parse") do |v|
19
+ options[:x] = v
20
+ end
21
+
22
+ parser.on("-y N", Float, "y/longitude to parse") do |v|
23
+ options[:y] = v
24
+ end
25
+ end.parse!
26
+
27
+ grid = SwedishGrid.new(:"#{ options[:from] }")
28
+
29
+ case options[:to]
30
+ when 'geodetic'
31
+ output = grid.grid_to_geodetic(options[:x], options[:y])
32
+ when 'grid'
33
+ output = grid.geodetic_to_grid(options[:x], options[:y])
34
+ else
35
+ raise 'Unknown to parameter'
36
+ end
37
+
38
+ puts output
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: swedishgrid-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hitta skyddsrum
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Simple interface for converting Swedish grid coordinates
14
+ email: admin@hittaskyddsrum.se
15
+ executables:
16
+ - swedishgrid
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/swedishgrid
21
+ homepage: http://rubygems.org/gems/swedishgrid-cli
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.7.5
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Swedish grid converter for CLI
45
+ test_files: []