proj4rb 0.3.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +9 -0
- data/README +169 -0
- data/data/GL27 +22 -0
- data/data/MD +0 -0
- data/data/TN +0 -0
- data/data/WI +0 -0
- data/data/WO +0 -0
- data/data/conus +0 -0
- data/data/epsg +5443 -0
- data/data/epsg-deprecated +2 -0
- data/data/esri +5937 -0
- data/data/esri.extra +948 -0
- data/data/hawaii +0 -0
- data/data/nad.lst +142 -0
- data/data/nad27 +809 -0
- data/data/nad83 +744 -0
- data/data/ntv1_can.dat +0 -0
- data/data/null +0 -0
- data/data/other.extra +49 -0
- data/data/proj_def.dat +17 -0
- data/data/prvi +0 -0
- data/data/stgeorge +0 -0
- data/data/stlrnc +0 -0
- data/data/stpaul +0 -0
- data/data/world +212 -0
- data/example/basic.rb +18 -0
- data/example/list-datums.rb +17 -0
- data/example/list-ellipsoids.rb +17 -0
- data/example/list-errors.rb +11 -0
- data/example/list-prime-meridians.rb +17 -0
- data/example/list-projection-types.rb +17 -0
- data/example/list-units.rb +17 -0
- data/example/version.rb +8 -0
- data/ext/extconf.rb +8 -0
- data/ext/mingw/rakefile.rb +38 -0
- data/ext/projrb.c +560 -0
- data/ext/vc/proj4_ruby.sln +19 -0
- data/ext/vc/proj4_ruby.vcproj +208 -0
- data/lib/proj4.rb +466 -0
- data/lib/proj4_ruby.so +0 -0
- data/rakefile.rb +130 -0
- data/test/test_constants.rb +20 -0
- data/test/test_create_projection.rb +64 -0
- data/test/test_datums.rb +44 -0
- data/test/test_ellipsoids.rb +45 -0
- data/test/test_errors.rb +70 -0
- data/test/test_init_projection.rb +108 -0
- data/test/test_prime_meridians.rb +44 -0
- data/test/test_projection_type.rb +43 -0
- data/test/test_simple_projection.rb +57 -0
- data/test/test_transform.rb +114 -0
- data/test/test_units.rb +45 -0
- metadata +117 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Copyright (c) 2000 Frank Warmerdam
|
2
|
+
|
3
|
+
Copyright (c) 2006 Guilhem Vellut <guilhem.vellut@gmail.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
=Proj4rb
|
2
|
+
|
3
|
+
This is a Ruby binding for the Proj.4 Carthographic Projection library
|
4
|
+
(http://trac.osgeo.org/proj/), that supports conversions between a large
|
5
|
+
number of geographic coordinate systems and datums.
|
6
|
+
|
7
|
+
Most functions of the C library are exposed to Ruby. In cases where
|
8
|
+
there is a direct equivalent between C and Ruby, identifiers (such as names of
|
9
|
+
functions and constants) are the same. But the usage has been changed to
|
10
|
+
take advantage of Ruby's object-oriented features.
|
11
|
+
|
12
|
+
== Operations
|
13
|
+
To load the library:
|
14
|
+
require 'proj4'
|
15
|
+
|
16
|
+
The classes are in the Proj4 module so you may wish to include it:
|
17
|
+
include Proj4
|
18
|
+
|
19
|
+
Next, you need to create a projection:
|
20
|
+
proj = Projection.new( :proj => "utm", :zone => "21", :units => "m" )
|
21
|
+
|
22
|
+
This defines a UTM21 North projection in WGS84. Note that the <tt>proj</tt> /
|
23
|
+
<tt>proj.exe</tt> initialization arguments equivalent to the one above would
|
24
|
+
be:
|
25
|
+
+proj=utm +zone=21 +units=m
|
26
|
+
|
27
|
+
Note there are several alternative ways of specifying the arguments, see
|
28
|
+
the documentation for Proj4::Projection.new for details.
|
29
|
+
|
30
|
+
Once you've created the projection, you can tranform coordinates using either
|
31
|
+
the +forward+ or +inverse+ methods. +forward+ transforms the point in WGS84
|
32
|
+
lon/lat (in radians) to the coordinate system defined during the creation
|
33
|
+
of the Projection object. +inverse+ does the opposite. For example:
|
34
|
+
|
35
|
+
projected_point = proj.forward(lonlat_point)
|
36
|
+
lonlat_point = proj.inverse(projected_point)
|
37
|
+
|
38
|
+
There is also a +transform+ function which can transform between any two
|
39
|
+
projections including datum conversions:
|
40
|
+
|
41
|
+
point_in_projB = projA.transform(projB, point_in_projA)
|
42
|
+
|
43
|
+
The +forward+, +inverse+, and +transform+ methods all have an in-place
|
44
|
+
equivalent: <tt>forward!</tt>, <tt>inverse!</tt>, and <tt>transform!</tt>
|
45
|
+
which projects the given point in place. There are also +forwardDeg+
|
46
|
+
and +inverseDeg+ methods which work with longitudes and latitudes in
|
47
|
+
degrees rather than radians.
|
48
|
+
|
49
|
+
For the points you can use an object of the Proj4::Point class. It has
|
50
|
+
properties: +x+, +y+, and +z+, which can be set and retrieved. Aliases
|
51
|
+
+lon+ and +lat+ for +x+ and +y+, respectively, are also available.
|
52
|
+
(There used to be a UV class, but this has been removed in version 0.3.0.)
|
53
|
+
|
54
|
+
Instead of using the Proj4::Point object, you may use another class as long
|
55
|
+
as it responds to the methods +x+ and +y+ (and +z+ for 3D datum transformations
|
56
|
+
with the +transform+ method).
|
57
|
+
|
58
|
+
The methods +forward_all+, +inverse_all+, and +transform_all+ (and their
|
59
|
+
in-place versions <tt>forward_all!</tt>, <tt>inverse_all!</tt>, and
|
60
|
+
<tt>transform_all!</tt> work just like their simple counterparts, but
|
61
|
+
instead of transforming a single point they transform a collection of points
|
62
|
+
in a single call. They take an array as an argument or any object that responds
|
63
|
+
to the +each+ method (for the in-place versions) or +each+, +clear+, and
|
64
|
+
<tt><<</tt> methods (for the normal version).
|
65
|
+
|
66
|
+
The library also defines two constants to make it easy to convert between
|
67
|
+
degrees and radians:
|
68
|
+
+DEG_TO_RAD+ and +RAD_TO_DEG+
|
69
|
+
|
70
|
+
==Error handling
|
71
|
+
Projection initialization (Proj4::Projection.new) and transformation functions
|
72
|
+
(Proj4::Projection#forward/inverse/transform) all throw exceptions when
|
73
|
+
they encounter an error. This is done by mapping proj4's C error codes to
|
74
|
+
Ruby specific exception classes. See Proj4::Error for more information or
|
75
|
+
use the <tt>list-errors.rb</tt> program from the examples for a list.
|
76
|
+
|
77
|
+
==Definition lists
|
78
|
+
Proj.4 supports many different datums, ellipsoids, prime meridians,
|
79
|
+
projection types and length units. Use the Proj4::Datum, Proj4::Ellipsoid,
|
80
|
+
Proj4::PrimeMeridian, Proj4::ProjectionType, and Proj4::Unit classes
|
81
|
+
to access this information and get detailed information about each definition.
|
82
|
+
See the <i>list-*</i> files in the <i>example</i> directory for code
|
83
|
+
examples.
|
84
|
+
|
85
|
+
Note that these lists rquire version 449 or later of the Proj.4 C library.
|
86
|
+
|
87
|
+
==Installation
|
88
|
+
To intsall the gem simply type:
|
89
|
+
gem install proj4rb
|
90
|
+
|
91
|
+
==Compiling
|
92
|
+
===Linux
|
93
|
+
To compile the proj4rb Ruby bindings from source you'll need the
|
94
|
+
Proj.4 C library installed. Then simply call:
|
95
|
+
rake build
|
96
|
+
|
97
|
+
If there is a problem, you can perform this step manually:
|
98
|
+
Enter the <i>ext</i> directory and create
|
99
|
+
a Makefile:
|
100
|
+
cd ext
|
101
|
+
ruby extconf.rb
|
102
|
+
If there are any problems consult the <i>mkmf.log</i> log file.
|
103
|
+
Then compile with
|
104
|
+
make
|
105
|
+
The result is the file <i>proj4_ruby.so</i>.
|
106
|
+
|
107
|
+
If you want to run the tests call
|
108
|
+
rake test
|
109
|
+
|
110
|
+
If you want to, you can now create a gem with
|
111
|
+
rake gem
|
112
|
+
|
113
|
+
This will create a file <tt>proj4rb-<i>version</i>-i486-linux.gem</tt>
|
114
|
+
or similar in the <i>pkg</i> directory.
|
115
|
+
|
116
|
+
===Mac OS X
|
117
|
+
To compile the proj4rb Ruby bindings from source you'll need the
|
118
|
+
Proj.4 C library installed. Enter the <i>ext</i> directory and create
|
119
|
+
a Makefile:
|
120
|
+
cd ext
|
121
|
+
ruby extconf.rb
|
122
|
+
If there are any problems consult the <i>mkmf.log</i> log file.
|
123
|
+
Then compile with
|
124
|
+
make
|
125
|
+
The result is the file <i>projrb.bundle</i> which you need to copy into
|
126
|
+
the <i>lib</i> directory:
|
127
|
+
cp projrb.bundle ../lib/
|
128
|
+
|
129
|
+
If you want to, you can now create a gem with
|
130
|
+
rake gem
|
131
|
+
|
132
|
+
This will create a file <tt>proj4rb-<i>version</i>-universal-darwin8.0.gem</tt>
|
133
|
+
or similar in the <i>pkg</i> directory.
|
134
|
+
|
135
|
+
===Windows
|
136
|
+
To build the library on Windows requires a working installation of Visual
|
137
|
+
Studio or MingW/msys. You of course also need to have proj4 installed.
|
138
|
+
|
139
|
+
If you are using Visual Studio, you'll find a Visual Studio 2008 project
|
140
|
+
file in ext/vc. You'll have to edit the various include and library paths
|
141
|
+
to fit your specific environment.
|
142
|
+
|
143
|
+
If you are using MingW/msys, then:
|
144
|
+
|
145
|
+
1. Open a msys prompt (a DOS prompt may also work)
|
146
|
+
2. Change diretories to ext/MingW
|
147
|
+
3. Type in rake
|
148
|
+
|
149
|
+
The result is a proj4_ruby.so file which can be package into a GEM or
|
150
|
+
copied to the ruby/site-lib directory.
|
151
|
+
|
152
|
+
==TODO
|
153
|
+
- Completely cross-platform build system (mkrf?)
|
154
|
+
|
155
|
+
==Changes since the last version
|
156
|
+
- Improved build system
|
157
|
+
|
158
|
+
==License
|
159
|
+
Proj4rb is released under the MIT license.
|
160
|
+
|
161
|
+
==Support
|
162
|
+
Any questions, enhancement proposals, bug notifications or corrections can be
|
163
|
+
sent to mailto:jochen@topf.org.
|
164
|
+
|
165
|
+
==Authors
|
166
|
+
The proj4rb Ruby bindings were started by Guilhem Vellut with most of the code
|
167
|
+
written by Jochen Topf. Charlie Savage ported the code to Windows and added
|
168
|
+
the Windows build infrastructure.
|
169
|
+
|
data/data/GL27
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# SCCSID @(#)GL27 1.1 93/08/25 GIE REL
|
2
|
+
# Great Lakes Grids
|
3
|
+
<erie-etal> # Lake Erie, Ontario and St. Lawrence River.
|
4
|
+
proj=omerc ellps=clrk66 k_0=0.9999
|
5
|
+
lonc=78d00'W lat_0=44d00'N alpha=55d40'
|
6
|
+
x_0=-3950000 y_0=-3430000
|
7
|
+
no_defs <>
|
8
|
+
<huron> # Lake Huron
|
9
|
+
proj=omerc ellps=clrk66 k_0=0.9999
|
10
|
+
lonc=82d00'W lat_0=43d00'N alpha=350d37'
|
11
|
+
x_0=1200000 y_0=-3500000
|
12
|
+
no_defs <>
|
13
|
+
<michigan> # Lake Michigan
|
14
|
+
proj=omerc ellps=clrk66 k_0=0.9999
|
15
|
+
lonc=87d00'W lat_0=44d00'N alpha=15d00'
|
16
|
+
x_0=-1000000 y_0=-4300000
|
17
|
+
no_defs <>
|
18
|
+
<superior> # Lake Superior, Lake of the Woods
|
19
|
+
proj=omerc ellps=clrk66 k_0=0.9999
|
20
|
+
lonc=88d50'0.256"W lat_0=47d12'21.554"N alpha=285d41'42.593"
|
21
|
+
x_0=9000000 y_0=-1600000
|
22
|
+
no_defs <>
|
data/data/MD
ADDED
Binary file
|
data/data/TN
ADDED
Binary file
|
data/data/WI
ADDED
Binary file
|
data/data/WO
ADDED
Binary file
|
data/data/conus
ADDED
Binary file
|