proj4rb 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/MIT-LICENSE +9 -0
  2. data/README +169 -0
  3. data/data/GL27 +22 -0
  4. data/data/MD +0 -0
  5. data/data/TN +0 -0
  6. data/data/WI +0 -0
  7. data/data/WO +0 -0
  8. data/data/conus +0 -0
  9. data/data/epsg +5443 -0
  10. data/data/epsg-deprecated +2 -0
  11. data/data/esri +5937 -0
  12. data/data/esri.extra +948 -0
  13. data/data/hawaii +0 -0
  14. data/data/nad.lst +142 -0
  15. data/data/nad27 +809 -0
  16. data/data/nad83 +744 -0
  17. data/data/ntv1_can.dat +0 -0
  18. data/data/null +0 -0
  19. data/data/other.extra +49 -0
  20. data/data/proj_def.dat +17 -0
  21. data/data/prvi +0 -0
  22. data/data/stgeorge +0 -0
  23. data/data/stlrnc +0 -0
  24. data/data/stpaul +0 -0
  25. data/data/world +212 -0
  26. data/example/basic.rb +18 -0
  27. data/example/list-datums.rb +17 -0
  28. data/example/list-ellipsoids.rb +17 -0
  29. data/example/list-errors.rb +11 -0
  30. data/example/list-prime-meridians.rb +17 -0
  31. data/example/list-projection-types.rb +17 -0
  32. data/example/list-units.rb +17 -0
  33. data/example/version.rb +8 -0
  34. data/ext/extconf.rb +8 -0
  35. data/ext/mingw/rakefile.rb +38 -0
  36. data/ext/projrb.c +560 -0
  37. data/ext/vc/proj4_ruby.sln +19 -0
  38. data/ext/vc/proj4_ruby.vcproj +208 -0
  39. data/lib/proj4.rb +466 -0
  40. data/rakefile.rb +130 -0
  41. data/test/test_constants.rb +20 -0
  42. data/test/test_create_projection.rb +64 -0
  43. data/test/test_datums.rb +44 -0
  44. data/test/test_ellipsoids.rb +45 -0
  45. data/test/test_errors.rb +70 -0
  46. data/test/test_init_projection.rb +108 -0
  47. data/test/test_prime_meridians.rb +44 -0
  48. data/test/test_projection_type.rb +43 -0
  49. data/test/test_simple_projection.rb +57 -0
  50. data/test/test_transform.rb +114 -0
  51. data/test/test_units.rb +45 -0
  52. metadata +105 -0
data/data/ntv1_can.dat ADDED
Binary file
data/data/null ADDED
Binary file
data/data/other.extra ADDED
@@ -0,0 +1,49 @@
1
+ ## NAD83 / BC Albers (this has been superceeded but is kept for compatibility)
2
+ <42102> +proj=aea +ellps=GRS80 +lat_0=45 +lon_0=-126.0 +lat_1=50.0 +lat_2=58.5 +x_0=1000000.0 +y_0=0 +datum=NAD83 +units=m no_defs <>
3
+
4
+
5
+ #
6
+ # OGC-defined extended codes (41000--41999)
7
+ # see http://www.digitalearth.gov/wmt/auto.html
8
+ #
9
+ # WGS84 / Simple Mercator
10
+ <41001> +proj=merc +lat_ts=0 +lon_0=0 +k=1.000000 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs no_defs <>
11
+ #
12
+ # CubeWerx-defined extended codes (42100--42199)
13
+ #
14
+ # WGS 84 / LCC Canada
15
+ <42101> +proj=lcc +lat_1=49 +lat_2=77 +lat_0=0 +lon_0=-95 +x_0=0 +y_0=-8000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs no_defs <>
16
+ #EPSG:42102,"PROJCS[\"NAD83 / BC Albers\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS_1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Decimal_Degree\",0.0174532925199433]],PROJECTION[\"Albers_conic_equal_area\"],PARAMETER[\"central_meridian\",-126.0],PARAMETER[\"latitude_of_origin\",45],PARAMETER[\"standard_parallel_1\",50.0],PARAMETER[\"standard_parallel_2\",58.5],PARAMETER[\"false_easting\",1000000.0],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]"
17
+ # WGS 84 / LCC USA
18
+ <42103> +proj=lcc +lat_1=33 +lat_2=45 +lat_0=0 +lon_0=-100 +x_0=0 +y_0=0 +ellps=WGS72 +datum=WGS84 +units=m +no_defs no_defs <>
19
+ # NAD83 / MTM zone 8 Québec
20
+ <42104> +proj=tmerc +lat_0=0 +lon_0=-73.5 +k=0.999900 +x_0=304800 +y_0=0 +ellps=GRS80 +units=m +no_defs no_defs <>
21
+ # WGS84 / Merc NorthAm
22
+ <42105> +proj=merc +lat_ts=0 +lon_0=-96 +k=1.000000 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs no_defs <>
23
+ # WGS84 / Lambert Azim Mozambique
24
+ <42106> +proj=laea +lat_0=5 +lon_0=20 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +datum=WGS84 +units=m +no_defs no_defs <>
25
+ #
26
+ # CubeWerx-customer definitions (42300--42399)
27
+ #
28
+ # NAD27 / Polar Stereographic / CM=-98
29
+ <42301> +proj=stere +lat_0=90 +lon_0=-98 +x_0=0 +y_0=0 +ellps=clrk66 +datum=NAD27 +units=m +no_defs no_defs <>
30
+ # JapanOrtho.09 09
31
+ <42302> +proj=tmerc +lat_0=36 +lon_0=139.833333333333 +k=0.999900 +x_0=0 +y_0=0 +ellps=bessel +units=m +no_defs no_defs <>
32
+ # NAD83 / Albers NorthAm
33
+ <42303> +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs no_defs <>
34
+ # NAD83 / NRCan LCC Canada
35
+ <42304> +proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs no_defs <>
36
+ # France_II
37
+ <42305> +proj=lcc +lat_1=45.898918964419 +lat_2=47.696014502038 +lat_0=46.8 +lon_0=2.337229166666667 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356514.999904194 +pm=2.337229166666667 +units=m +no_defs no_defs <>
38
+ # NAD83/QC_LCC
39
+ <42306> +proj=lcc +lat_1=46 +lat_2=60 +lat_0=44 +lon_0=-68.5 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs no_defs <>
40
+ # NAD83 / Texas Central - feet
41
+ <42307> +proj=lcc +lat_1=31.8833333333333 +lat_2=30.1166666666667 +lat_0=29.6666666666667 +lon_0=-100.333333333333 +x_0=700000.0000000001 +y_0=3000000 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs no_defs <>
42
+ # NAD27 / California Albers
43
+ <42308> +proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0 +y_0=-4000000 +ellps=clrk66 +datum=NAD27 +units=m +no_defs no_defs <>
44
+ # NAD 83 / LCC Canada AVHRR-2
45
+ <42309> +proj=lcc +lat_1=49 +lat_2=77 +lat_0=0 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs no_defs <>
46
+ # WGS84+GRS80 / Mercator
47
+ <42310> +proj=merc +lat_ts=0 +lon_0=0 +k=1.000000 +x_0=0 +y_0=0 +ellps=GRS80 +datum=WGS84 +units=m +no_defs no_defs <>
48
+ # NAD83 / LCC Statcan
49
+ <42311> +proj=lcc +lat_1=49 +lat_2=77 +lat_0=63.390675 +lon_0=-91.86666700000001 +x_0=6200000 +y_0=3000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs no_defs <>
data/data/proj_def.dat ADDED
@@ -0,0 +1,17 @@
1
+ # Projection library defaults file
2
+ # SCCSID--- @(#)proj_def.dat 4.3 94/02/23 GIE REL"
3
+ # very preliminary version
4
+ <general>
5
+ ellps=WGS84
6
+ <>
7
+ <aea> # Conterminous U.S. map
8
+ lat_1=29.5
9
+ lat_2=45.5
10
+ <>
11
+ <lcc> # Conterminous U.S. map
12
+ lat_1=33
13
+ lat_2=45
14
+ <>
15
+ <lagrng>
16
+ W=2
17
+ <>
data/data/prvi ADDED
Binary file
data/data/stgeorge ADDED
Binary file
data/data/stlrnc ADDED
Binary file
data/data/stpaul ADDED
Binary file
data/data/world ADDED
@@ -0,0 +1,212 @@
1
+ # SCCSID @(#)world 1.2 95/08/05 GIE REL
2
+ # proj +init files for various non-U.S. coordinate systems.
3
+ #
4
+ <CH1903> # Swiss Coordinate System
5
+ +proj=somerc +lat_0=46d57'8.660"N +lon_0=7d26'22.500"E
6
+ +ellps=bessel +x_0=600000 +y_0=200000
7
+ +k_0=1. no_defs <>
8
+ <madagascar> # Laborde grid for Madagascar
9
+ proj=labrd ellps=intl lon_0=46d26'13.95E lat_0=18d54S
10
+ azi=18d54 k_0=.9995 x_0=400000 y_0=800000
11
+ no_defs <>
12
+ <new_zealand> # New Zealand Map Grid (NZMG)
13
+ proj=nzmg # Projection unique to N.Z. so all factors fixed
14
+ no_defs <>
15
+ # Secondary grids DMA TM8358.1, p. 4.3
16
+ <bwi> # British West Indies
17
+ proj=tmerc ellps=clrk80 lon_0=62W
18
+ x_0=400000 k_0=0.9995
19
+ no_defs <>
20
+ <costa-n> # Costa Rica Norte
21
+ proj=lcc ellps=clrk66 lat_1=10d28N lon_0=84d20W
22
+ x_0=500000 y_0=217820.522 k_0=0.99995696
23
+ no_defs <>
24
+ <costa-s> # Costa Rica Sud
25
+ proj=lcc ellps=clrk66 lat_1=9dN lon_0=83d40W
26
+ x_0=500000 y_0=327987.436 k_0=0.99995696
27
+ no_defs <>
28
+ <cuba-n> # Cuba Norte
29
+ proj=lcc ellps=clrk66 lat_1=22d21N lon_0=81dW
30
+ x_0=500000 y_0=280296.016 k_0=0.99993602
31
+ no_defs <>
32
+ <cuba-s> # Cuba Sud
33
+ proj=lcc ellps=clrk66 lat_1=20d43'N lon_0=76d50'W
34
+ x_0=500000 y_0=229126.939 k_0=0.99994848
35
+ no_defs <>
36
+ <domin_rep> # Dominican Republic
37
+ proj=lcc ellps=clrk66 lat_1=18d49'N lon_0=71d30'W
38
+ x_0=500000 y_0=277063.657 k_0=0.99991102
39
+ no_defs <>
40
+ <egypt-1> # Egypt
41
+ proj=tmerc ellps=intl lon_0=25d30'E x_0=300000 k_0=0.99985
42
+ no_defs <>
43
+ <egypt-2> # Egypt
44
+ proj=tmerc ellps=intl lon_0=28d30'E x_0=300000 k_0=0.99985
45
+ no_defs <>
46
+ <egypt-3> # Egypt
47
+ proj=tmerc ellps=intl lon_0=31d30'E x_0=300000 k_0=0.99985
48
+ no_defs <>
49
+ <egypt-4> # Egypt
50
+ proj=tmerc ellps=intl lon_0=34d30'E x_0=300000 k_0=0.99985
51
+ no_defs <>
52
+ <egypt-5> # Egypt
53
+ proj=tmerc ellps=intl lon_0=37d30'E x_0=300000 k_0=0.99985
54
+ no_defs <>
55
+ <el_sal> # El Salvador
56
+ proj=lcc ellps=clrk66 lat_1=13d47'N lon_0=89dW
57
+ x_0=500000 y_0=295809.184 k_0=0.99996704
58
+ no_defs <>
59
+ <guat-n> # Guatemala Norte
60
+ proj=lcc ellps=clrk66 lat_1=16d49'N lon_0=90d20'W
61
+ x_0=500000 y_0=292209.579 k_0=0.99992226
62
+ no_defs <>
63
+ <guat-s> # Guatemala Sud
64
+ proj=lcc ellps=clrk66 lat_1=14d54'N lon_0=90d20'W
65
+ x_0=500000 y_0=325992.681 k_0=0.99989906
66
+ no_defs <>
67
+ <haiti> # Haiti
68
+ proj=lcc ellps=clrk66 lat_1=18d49'N lon_0=71d30'W
69
+ x_0=500000 y_0=277063.657 k_0=0.99991102
70
+ no_defs <>
71
+ <hond-n> # Honduras Norte
72
+ proj=lcc ellps=clrk66 lat_1=15d30'N lon_0=86d10'W
73
+ x_0=500000 y_0=296917.439 k_0=0.99993273
74
+ no_defs <>
75
+ <hond-s> # Honduras Sud
76
+ proj=lcc ellps=clrk66 lat_1=13d47'N lon_0=87d10'W
77
+ x_0=500000 y_0=296215.903 k_0=0.99995140
78
+ no_defs <>
79
+ <levant> # Levant
80
+ proj=lcc ellps=clrk66 lat_1=34d39'N lon_0=37d21'E
81
+ x_0=500000 y_0=300000 k_0=0.9996256
82
+ no_defs <>
83
+ <nica-n> # Nicaragua Norte
84
+ proj=lcc ellps=clrk66 lat_1=13d52'N lon_0=85d30'W
85
+ x_0=500000 y_0=359891.816 k_0=0.99990314
86
+ no_defs <>
87
+ <nica-s> # Nicaragua Sud
88
+ proj=lcc ellps=clrk66 lat_1=11d40'N lon_0=85d30'W
89
+ x_0=500000 y_0=288876.327 k_0=0.99992228
90
+ no_defs <>
91
+ <nw-africa> # Northwest Africa
92
+ proj=lcc ellps=clrk80 lat_1=34dN lon_0=0dE
93
+ x_0=1000000 y_0=500000 k_0=0.99908
94
+ no_defs <>
95
+ <palestine> # Palestine
96
+ proj=tmerc a=6378300.79 rf=293.488307656
97
+ lat_0=31d44'2.749"N lon_0=35d12'43.490"E
98
+ x_0=170251.555 y_0=126867.909 k_0=1
99
+ no_defs <>
100
+ <panama> # Panama
101
+ proj=lcc ellps=clrk66 lat_1=8d25'N lon_0=80dW
102
+ x_0=500000 y_0=294865.303 k_0=0.99989909
103
+ no_defs <>
104
+ # other grids in DMA TM8358.1
105
+ <bng> # British National Grid
106
+ proj=tmerc ellps=airy lat_0=49dN lon_0=2dW
107
+ k_0=0.9996012717 x_0=400000 y_0=-100000
108
+ no_defs <>
109
+ <malay> # West Malaysian RSO Grid
110
+ proj=omerc a=6377295.66402 rf=300.8017 alpha=323d01'32.846"
111
+ no_uoff rot_conv lonc=102d15E lat_0=4dN k_0=0.99984 x_0=804670.240 y_0=0
112
+ no_defs <>
113
+ <india-I> # India Zone I
114
+ proj=lcc ellps=everest lon_0=68E lat_1=32d30'N
115
+ x_0=2743185.69 y_0=914395.23 k_0=.998786408
116
+ no_defs <>
117
+ <india-IIA> # India Zone IIA
118
+ proj=lcc ellps=everest lon_0=74E lat_1=26N
119
+ x_0=2743185.69 y_0=914395.23 k_0=.998786408
120
+ no_defs <>
121
+ <india-IIB> # India Zone IIB
122
+ proj=lcc ellps=everest lon_0=90E lat_1=26N
123
+ x_0=2743185.69 y_0=914395.23 k_0=.998786408
124
+ no_defs <>
125
+ <india-IIIA> # India Zone IIIA
126
+ proj=lcc ellps=everest lon_0=80E lat_1=19N
127
+ x_0=2743185.69 y_0=914395.23 k_0=.998786408
128
+ no_defs <>
129
+ <india-IIIB> # India Zone IIIB
130
+ proj=lcc ellps=everest lon_0=100E lat_1=19N
131
+ x_0=2743185.69 y_0=914395.23 k_0=.998786408
132
+ no_defs <>
133
+ <india-IVA> # India Zone IVA
134
+ proj=lcc ellps=everest lon_0=80E lat_1=12N
135
+ x_0=2743185.69 y_0=914395.23 k_0=.998786408
136
+ no_defs <>
137
+ <india-IVB> # India Zone IVB
138
+ proj=lcc ellps=everest lon_0=104E lat_1=12N
139
+ x_0=2743185.69 y_0=914395.23 k_0=.998786408
140
+ no_defs <>
141
+ <ceylon> # Ceylon Belt
142
+ proj=tmerc ellps=everest lon_0=80d46'18.160"E lat_0=7d0'1.729"N
143
+ x_0=160933.56048 y_0=160933.56048 k_0=1.
144
+ no_defs <>
145
+ <irish> # Irish Transverse Mercator Grid
146
+ proj=tmerx ellps=mod_airy lat_0=53d30'N lon_0=8W
147
+ x_0=200000 y_0=-250000 k_0=1.000035
148
+ no_defs <>
149
+ <neiez> # Netherlands East Indies Equitorial Zone
150
+ proj=merc ellps=bessel lon_0=110E
151
+ x_0=3900000 y_0=900000 k_0=0.997
152
+ no_defs <>
153
+ <n-alger> # Nord Algerie Grid
154
+ proj=lcc ellps=clrk80 lon_0=2d42E lat_0=36N
155
+ x_0=500000 y_0=300000 k_0=0.999625544
156
+ no_defs <>
157
+ <n-maroc> # Nord Maroc Grid
158
+ proj=lcc ellps=clrk80 lon_0=5d24'W lat_0=33d18'N
159
+ x_0=500000 y_0=300000 k_0=0.999625769
160
+ no_defs <>
161
+ <n-tunis> # Nord Tunisie Grid
162
+ proj=lcc ellps=clrk80 lon_0=9d54E lat_0=36N
163
+ x_0=500000 y_0=300000 k_0=0.999625544
164
+ no_defs <>
165
+ <s-alger> # Sud Algerie Grid
166
+ proj=lcc ellps=clrk80 lon_0=2d42E lat_0=33d18'N
167
+ x_0=500000 y_0=300000 k_0=0.999625769
168
+ no_defs <>
169
+ <s-maroc> # Sud Maroc Grid
170
+ proj=lcc ellps=clrk80 lon_0=5d24W lat_0=29d42'N
171
+ x_0=500000 y_0=300000 k_0=0.999615596
172
+ no_defs <>
173
+ <s-tunis> # Sud Tunisie Grid
174
+ proj=lcc ellps=clrk80 lon_0=9d54'E lat_0=33d18'N
175
+ x_0=500000 y_0=300000 k_0=0.999625769
176
+ no_defs <>
177
+ # Gauss Krueger Grid for Germany
178
+ #
179
+ # The first figure of the easting is lon_0 devided by 3
180
+ # ( 2 for 6d0E, 3 for 9d0E, 4 for 12d0E)
181
+ # For translations you have to remove this first figure
182
+ # and convert northings and eastings from km to meter .
183
+ # The other way round, devide by 1000 and add the figure.
184
+ # I made 3 entrys for the officially used grids in Germany
185
+ #
186
+ #
187
+ # Und nochmal in deutsch :
188
+ # Die erste Ziffer des Rechtswerts beschreibt den Hauptmeridian
189
+ # und ist dessen Gradzahl geteilt durch 3.
190
+ # Zum Umrechnen in Grad muss daher die erste Ziffer des Rechtswertes
191
+ # entfernt werden und evt. von km auf Metern umgerechnet werden.
192
+ # Zur Umrechnung in Gauss Krueger Koordinaten entsprechend die
193
+ # Ziffer fuer den Hauptmeridian vor dem Rechtswert ergaenzen.
194
+ # Ich hab fuer alle drei in Deutschland ueblichen Hauptmeridiane
195
+ # jeweils einen Eintrag ergaenzt.
196
+ #
197
+ #
198
+ # added by Michael Goepel <goepel@ffm.plusline.de>
199
+ #
200
+ <gk2-d> # Gauss Krueger Grid for Germany
201
+ proj=tmerc ellps=bessel lon_0=6d0E lat_0=0
202
+ x_0=500000
203
+ no_defs<>
204
+ <gk3-d> # Gauss Krueger Grid for Germany
205
+ proj=tmerc ellps=bessel lon_0=9d0E lat_0=0
206
+ x_0=500000
207
+ no_defs<>
208
+ <gk4-d> # Gauss Krueger Grid for Germany
209
+ proj=tmerc ellps=bessel lon_0=12d0E lat_0=0
210
+ x_0=500000
211
+ no_defs<>
212
+
data/example/basic.rb ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+ include Proj4
7
+
8
+ # create projection object
9
+ proj = Projection.new(["proj=utm", "zone=21", "units=m", "no.defs"])
10
+
11
+ # create the point you want to project
12
+ point = Point.new(45000,2700000)
13
+
14
+ # do the projection
15
+ res = proj.inverse(point)
16
+
17
+ puts "x=#{point.x}, y=#{point.y} ==> lon=#{res.lon}, lat=#{res.lat}"
18
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+ include Proj4
7
+
8
+ if ARGV[0] == '-v'
9
+ puts "%-15s %-10s %-50s" % [ 'ID', 'Ellipse ID', 'Comment' ]
10
+ puts '-----------------------------------------------------------------------------'
11
+ Datum.list.sort.each do |datum|
12
+ puts "%-15s %-10s %-50s\n %s\n " % [ datum.id, datum.ellipse_id, datum.comments, datum.defn ]
13
+ end
14
+ else
15
+ puts Datum.list.sort
16
+ end
17
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+ include Proj4
7
+
8
+ if ARGV[0] == '-v'
9
+ puts "%-9s %-14s %-18s %-36s" % [ 'ID', 'a', 'b/rf', 'Name' ]
10
+ puts '-----------------------------------------------------------------------------'
11
+ Ellipsoid.list.sort.each do |ell|
12
+ puts "%-9s %-14s %-18s %-36s" % [ ell.id, ell.major, ell.ell, ell.name ]
13
+ end
14
+ else
15
+ puts Ellipsoid.list.sort
16
+ end
17
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+ include Proj4
7
+
8
+ Error.list.collect{ |e| e + 'Error' }.each_with_index do |error, index|
9
+ puts "%2d %s" % [index, error]
10
+ end
11
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+ include Proj4
7
+
8
+ if ARGV[0] == '-v'
9
+ puts "%-16s %-50s" % [ 'ID', 'Definition' ]
10
+ puts '-----------------------------------------------------------------------------'
11
+ PrimeMeridian.list.sort.each do |pm|
12
+ puts "%-16s %-50s" % [ pm.id, pm.defn ]
13
+ end
14
+ else
15
+ puts PrimeMeridian.list.sort
16
+ end
17
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+ include Proj4
7
+
8
+ if ARGV[0] == '-v'
9
+ puts "%-7s %-70s" % [ 'ID', 'Name/Description' ]
10
+ puts '-----------------------------------------------------------------------------'
11
+ ProjectionType.list.sort.each do |pt|
12
+ puts "%-7s %-70s" % [ pt.id, pt.descr ]
13
+ end
14
+ else
15
+ puts ProjectionType.list
16
+ end
17
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+ include Proj4
7
+
8
+ if ARGV[0] == '-v'
9
+ puts "%-8s %-20s %-50s" % [ 'ID', 'To meter', 'Name' ]
10
+ puts "------------------------------------------------------------------------------"
11
+ Unit.list.sort.each do |unit|
12
+ puts "%-8s %-20s %-50s" % [ unit.id, unit.to_meter, unit.name ]
13
+ end
14
+ else
15
+ puts Unit.list.sort
16
+ end
17
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib/' << File.dirname(__FILE__) + '/../ext/'
4
+
5
+ require 'proj4'
6
+
7
+ puts Proj4::LIBVERSION
8
+
data/ext/extconf.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'mkmf'
2
+
3
+ # help with compiling on Mac OS X
4
+ $CFLAGS += " -I/sw/include"
5
+ $LDFLAGS += " -L/sw/lib"
6
+
7
+ have_library 'proj', 'pj_init'
8
+ create_makefile 'proj4_ruby'
@@ -0,0 +1,38 @@
1
+ # We can't use Ruby's standard build procedures
2
+ # on Windows because the Ruby executable is
3
+ # built with VC++ while here we want to build
4
+ # with MingW. So just roll our own...
5
+
6
+ require 'rake/clean'
7
+ require 'rbconfig'
8
+
9
+ RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
10
+ RUBY_BIN_DIR = Config::CONFIG["bindir"]
11
+ RUBY_LIB_DIR = Config::CONFIG["libdir"]
12
+ RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
13
+ RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
14
+
15
+ EXTENSION_NAME = "proj4_ruby.#{Config::CONFIG["DLEXT"]}"
16
+
17
+ CLEAN.include('*.o')
18
+ CLOBBER.include(EXTENSION_NAME)
19
+
20
+ task :default => "projrb"
21
+
22
+ SRC = FileList['../*.c']
23
+ OBJ = SRC.collect do |file_name|
24
+ File.basename(file_name).ext('o')
25
+ end
26
+
27
+ SRC.each do |srcfile|
28
+ objfile = File.basename(srcfile).ext('o')
29
+ file objfile => srcfile do
30
+ command = "gcc -c -fPIC -O2 -Wall -mms-bitfields -o #{objfile} #{srcfile} -I#{RUBY_INCLUDE_DIR} -I/local/include"
31
+ sh "sh -c '#{command}'"
32
+ end
33
+ end
34
+
35
+ file "projrb" => OBJ do
36
+ command = "gcc -shared -o #{EXTENSION_NAME} #{OBJ} -lproj #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL} -L/local/lib"
37
+ sh "sh -c '#{command}'"
38
+ end