swedishgrid 0.1.3 → 0.1.4
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.
- data/lib/swedishgrid.rb +4 -2
- metadata +2 -2
data/lib/swedishgrid.rb
CHANGED
@@ -25,7 +25,7 @@ class SwedishGrid
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# Conversion from grid coordinates to geodetic coordinates.
|
28
|
-
def grid_to_geodetic(x, y)
|
28
|
+
def grid_to_geodetic(x, y, decimals=nil)
|
29
29
|
# Prepare ellipsoid-based stuff.
|
30
30
|
e2 = @flattening * (2.0 - @flattening)
|
31
31
|
n = @flattening / (2.0 - @flattening)
|
@@ -63,7 +63,9 @@ class SwedishGrid
|
|
63
63
|
bstar*(Math.sin(phi_star) ** 2) +
|
64
64
|
cstar*(Math.sin(phi_star) ** 4) +
|
65
65
|
dstar*(Math.sin(phi_star) ** 6))
|
66
|
-
|
66
|
+
res = [lat_radian * 180.0 / Math::PI, lng_radian * 180.0 / Math::PI]
|
67
|
+
res.map do |x| (x * 10**decimals).round / 10**decimals end unless decimals.nil?
|
68
|
+
return res
|
67
69
|
end
|
68
70
|
|
69
71
|
# Conversion from geodetic coordinates to grid coordinates.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swedishgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
47
|
rubyforge_project:
|
48
|
-
rubygems_version: 1.8.
|
48
|
+
rubygems_version: 1.8.25
|
49
49
|
signing_key:
|
50
50
|
specification_version: 2
|
51
51
|
summary: Convert coordinates between geodetic WGS84 and Swedish grid RT90 and SWEREF99
|