proj4r 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_ca.rb ADDED
@@ -0,0 +1,17 @@
1
+ require "proj4r"
2
+ require "carray"
3
+
4
+ a = CA_DOUBLE(100)
5
+ b = CA_DOUBLE(30)
6
+ c = CA_DOUBLE(-100)
7
+
8
+ geod = PROJ4::Geod.new("+ellps=WGS84 +units=km")
9
+ geod.inverse(100, 30, -100, -30, a, b, c)
10
+ #=> [94.9053479513086, -85.0946520486914, 18101.7096098234]
11
+
12
+ p [a, b, c]
13
+
14
+ geod.distance(100, 30, -100, -30, a)
15
+ #=> [94.9053479513086, -85.0946520486914, 18101.7096098234]
16
+
17
+ p a
@@ -0,0 +1,25 @@
1
+ require "proj4r"
2
+
3
+ #
4
+ # PROJ4::Geod.new(a = 6378137, f = 1.0/298.257223563)
5
+ #
6
+ # PROJ4::Geod.inverse(lat1, lon1, lat2, lon2)
7
+ #
8
+ # -> distance, azi1, azi2
9
+ #
10
+
11
+ geod = PROJ4::Geod.new("+ellps=WGS84 +units=km")
12
+ p geod.inverse(30,100,-30,-100)
13
+ # => [18101709.587288667, 94.90534751023246, 94.90534751023246]
14
+
15
+ geod2 = PROJ4::Geod.new()
16
+ p geod2.inverse(30,100,-30,-100)
17
+ # => [18101709.587288667, 94.90534751023246, 94.90534751023246]
18
+
19
+ p geod.inverse(30,100,-30,-120)
20
+ # => [18101709.587288667, 94.90534751023246, 94.90534751023246]
21
+
22
+
23
+ p geod.inverse(42.25, -71.11666666666666, 45.516, -123.68)
24
+ p geod.inverse(CA_DOUBLE(42.25), CA_DOUBLE(-71.11666666666666),
25
+ CA_DOUBLE(45.516), CA_DOUBLE(-123.68))
data/test/test_proj.rb ADDED
@@ -0,0 +1,14 @@
1
+ require "proj4r"
2
+
3
+ pj = PROJ4::Proj.new("+init=EPSG:3857")
4
+
5
+ p pj.definition
6
+ p pj.latlong?
7
+
8
+ x, y = pj.forward(135,32)
9
+
10
+ p [x, y]
11
+
12
+ lon, lat = pj.inverse(x, y)
13
+
14
+ p [lon, lat]
@@ -0,0 +1,15 @@
1
+ require "proj4r"
2
+ require "carray"
3
+
4
+ pj = PROJ4::Proj.new("+init=EPSG:3857")
5
+
6
+ lat = CArray.double(10).seq(0,5)
7
+ lon = CArray.double(10) { 135 }
8
+
9
+ x, y = pj.forward(lon, lat)
10
+
11
+ p [x, y]
12
+
13
+ lon, lat = pj.inverse(x, y)
14
+
15
+ p [lon, lat]
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: proj4r
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Hiroki Motoyoshi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: " Extension library for PROJ.4\n"
14
+ email: ''
15
+ executables: []
16
+ extensions:
17
+ - extconf.rb
18
+ extra_rdoc_files: []
19
+ files:
20
+ - API.md
21
+ - README.md
22
+ - extconf.rb
23
+ - lib/proj4r.rb
24
+ - proj4r.gemspec
25
+ - rb_geod.c
26
+ - rb_proj.c
27
+ - rb_proj4r.c
28
+ - rb_proj4r.h
29
+ - test/TEST.txt
30
+ - test/attributes.rb
31
+ - test/tenkizu.rb
32
+ - test/test.rb
33
+ - test/test_ca.rb
34
+ - test/test_geod_ca.rb
35
+ - test/test_proj.rb
36
+ - test/test_proj_ca.rb
37
+ homepage: https://github.com/himotoyoshi/proj4r
38
+ licenses: []
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 1.8.1
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubyforge_project:
56
+ rubygems_version: 2.7.6
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: Extension library for PROJ.4
60
+ test_files: []