Debian Codegraph @

README

raw
1 NAME
2 Geo::Coordinates::UTM - Perl extension for Latitiude Longitude
3 conversions.
4
5 SYNOPSIS
6 use Geo::Coordinates::UTM;
7
8 my ($zone,$easting,$northing)=latlon_to_utm($ellipsoid,$latitude,$longitude);
9
10 my ($latitude,$longitude)=utm_to_latlon($ellipsoid,$zone,$easting,$northing);
11
12 my ($zone,$easting,$northing)=mgrs_to_utm($mgrs);
13
14 my ($latitude,$longitude)=mgrs_to_latlon($ellipsoid,$mgrs);
15
16 my ($mgrs)=utm_to_mgrs($zone,$easting,$northing);
17
18 my ($mgrs)=latlon_to_mgrs($ellipsoid,$latitude,$longitude);
19
20 my @ellipsoids=ellipsoid_names;
21
22 my($name, $r, $sqecc) = ellipsoid_info 'WGS-84';
23
24 DESCRIPTION
25 This module will translate latitude longitude coordinates to Universal
26 Transverse Mercator(UTM) coordinates and vice versa.
27
28 Mercator Projection
29
30 The Mercator projection was first invented to help mariners. They needed
31 to be able to take a course and know the distance traveled, and draw a
32 line on the map which showed the day's journey. In order to do this,
33 Mercator invented a projection which preserved length, by projecting the
34 earth's surface onto a cylinder, sharing the same axis as the earth
35 itself. This caused all Latitude and Longitude lines to intersect at a
36 90 degree angle, thereby negating the problem that longitude lines get
37 closer together at the poles.
38
39 Transverse Mercator Projection
40
41 A Transverse Mercator projection takes the cylinder and turns it on its
42 side. Now the cylinder's axis passes through the equator, and it can be
43 rotated to line up with the area of interest. Many countries use
44 Transverse Mercator for their grid systems.
45
46 Universal Transverse Mercator
47
48 The Universal Transverse Mercator(UTM) system sets up a universal world
49 wide system for mapping. The Transverse Mercator projection is used,
50 with the cylinder in 60 positions. This creates 60 zones around the
51 world. Positions are measured using Eastings and Northings, measured in
52 meters, instead of Latitude and Longitude. Eastings start at 500,000 on
53 the centre line of each zone. In the Northern Hemisphere, Northings are
54 zero at the equator and increase northward. In the Southern Hemisphere,
55 Northings start at 10 million at the equator, and decrease southward.
56 You must know which hemisphere and zone you are in to interpret your
57 location globally. Distortion of scale, distance, direction and area
58 increase away from the central meridian.
59
60 UTM projection is used to define horizontal positions world-wide by
61 dividing the surface of the Earth into 6 degree zones, each mapped by
62 the Transverse Mercator projection with a central meridian in the center
63 of the zone. UTM zone numbers designate 6 degree longitudinal strips
64 extending from 80 degrees South latitude to 84 degrees North latitude.
65 UTM zone characters designate 8 degree zones extending north and south
66 from the equator. Eastings are measured from the central meridian (with
67 a 500 km false easting to insure positive coordinates). Northings are
68 measured from the equator (with a 10,000 km false northing for positions
69 south of the equator).
70
71 UTM is applied separately to the Northern and Southern Hemisphere, thus
72 within a single UTM zone, a single X / Y pair of values will occur in
73 both the Northern and Southern Hemisphere. To eliminate this confusion,
74 and to speed location of points, a UTM zone is sometimes subdivided into
75 20 zones of Latitude. These grids can be further subdivided into 100,000
76 meter grid squares with double-letter designations. This subdivision by
77 Latitude and further division into grid squares is generally referred to
78 as the Military Grid Reference System (MGRS). The unit of measurement of
79 UTM is always meters and the zones are numbered from 1 to 60 eastward,
80 beginning at the 180th meridian. The scale distortion in a north-south
81 direction parallel to the central meridian (CM) is constant However, the
82 scale distortion increases either direction away from the CM. To
83 equalize the distortion of the map across the UTM zone, a scale factor
84 of 0.9996 is applied to all distance measurements within the zone. The
85 distortion at the zone boundary, 3 degrees away from the CM is
86 approximately 1%.
87
88 Datums and Ellipsoids
89
90 Unlike local surveys, which treat the Earth as a plane, the precise
91 determination of the latitude and longitude of points over a broad area
92 must take into account the actual shape of the Earth. To achieve the
93 precision necessary for accurate location, the Earth cannot be assumed
94 to be a sphere. Rather, the Earth's shape more closely approximates an
95 ellipsoid (oblate spheroid): flattened at the poles and bulging at the
96 Equator. Thus the Earth's shape, when cut through its polar axis,
97 approximates an ellipse. A "Datum" is a standard representation of shape
98 and offset for coordinates, which includes an ellipsoid and an origin.
99 You must consider the Datum when working with geospatial data, since
100 data with two different Datum will not line up. The difference can be as
101 much as a kilometer!
102
103 EXAMPLES
104 A description of the available ellipsoids and sample usage of the
105 conversion routines follows
106
107 Ellipsoids
108
109 The Ellipsoids available are as follows:
110
111 1 Airy
112 2 Australian National
113 3 Bessel 1841
114 4 Bessel 1841 Nambia
115 5 Clarke 1866
116 6 Clarke 1880
117 7 Everest
118 8 Fischer 1960 Mercury
119 9 Fischer 1968
120 10 GRS 1967
121 11 GRS 1980
122 12 Helmert 1906
123 13 Hough
124 14 International
125 15 Krassovsky
126 16 Modified Airy
127 17 Modified Everest
128 18 Modified Fischer 1960
129 19 South American 1969
130 20 WGS 60
131 21 WGS 66
132 22 WGS-72
133 23 WGS-84
134 24 Everest 1830 Malaysia
135 25 Everest 1956 India
136 26 Everest 1964 Malaysia and Singapore
137 27 Everest 1969 Malaysia
138 28 Everest Pakistan
139 29 Indonesian 1974
140 30 Arc 1950
141 31 NAD 27
142 32 NAD 83
143
144 ellipsoid_names
145
146 The ellipsoids can be accessed using ellipsoid_names. To store thes into
147 an array you could use
148
149 my @names = ellipsoid_names;
150
151 ellipsoid_info
152
153 Ellipsoids may be called either by name, or number. To return the
154 ellipsoid information, ( "official" name, equator radius and square
155 eccentricity) you can use ellipsoid_info and specify a name. The
156 specified name can be numeric (for compatibility reasons) or a
157 more-or-less exact name. Any text between parentheses will be ignored.
158
159 my($name, $r, $sqecc) = ellipsoid_info 'wgs84';
160 my($name, $r, $sqecc) = ellipsoid_info 'WGS 84';
161 my($name, $r, $sqecc) = ellipsoid_info 'WGS-84';
162 my($name, $r, $sqecc) = ellipsoid_info 'WGS-84 (new specs)';
163 my($name, $r, $sqecc) = ellipsoid_info 23;
164
165 latlon_to_utm
166
167 Latitude values in the southern hemisphere should be supplied as
168 negative values (e.g. 30 deg South will be -30). Similarly Longitude
169 values West of the meridian should also be supplied as negative values.
170 Both latitude and longitude should not be entered as deg,min,sec but as
171 their decimal equivalent, e.g. 30 deg 12 min 22.432 sec should be
172 entered as 30.2062311
173
174 The ellipsoid value should correspond to one of the numbers above, e.g.
175 to use WGS-84, the ellipsoid value should be 23
176
177 For latitude 57deg 49min 59.000sec North longitude 02deg 47min 20.226sec
178 West
179
180 using Clarke 1866 (Ellipsoid 5)
181
182 ($zone,$east,$north)=latlon_to_utm('clarke 1866',57.803055556,-2.788951667)
183
184 returns
185
186 $zone = 30V
187 $east = 512533.364651484
188 $north = 6409932.13416127
189
190 utm_to_latlon
191
192 Reversing the above example,
193
194 ($latitude,$longitude)=utm_to_latlon(5,30V,512533.364651484,6409932.13416127)
195
196 returns
197
198 $latitude = 57.8330555601433
199 $longitude = -2.788951666974
200
201 which equates to
202
203 latitude 57deg 49min 59.000sec North
204 longitude 02deg 47min 20.226sec West
205
206 latlon_to_utm_force_zone
207
208 On occasions, it is necessary to map a pair of (latitude, longitude)
209 coordinates to a predefined zone. This function allows to select the
210 projection zone as follows:
211
212 ($zone, $east, $north)=latlon_to_utm('international', $zone_number,
213 $latitude, $longitude)
214
215 For instance, Spain territory goes over zones 29, 30 and 31 but
216 sometimes it is convenient to use the projection corresponding to zone
217 30 for all the country.
218
219 Santiago de Compostela is at 42deg 52min 57.06sec North, 8deg 32min 28.70sec West
220
221 ($zone, $east, $norh)=latlon_to_utm('international', 42.882517, -8.541306)
222
223 returns
224
225 $zone = 29T
226 $east = 537460.331
227 $north = 4747955.991
228
229 but forcing the conversion to zone 30:
230
231 ($zone, $east, $norh)=latlon_to_utm_force_zone('international',
232 30, 42.882517, -8.541306)
233
234 returns
235
236 $zone = 30T
237 $east = 47404.442
238 $north = 4762771.704
239
240 latlon_to_mgrs
241
242 Latitude values in the southern hemisphere should be supplied as negative values (e.g. 30 deg South will be -30). Similarly Longitude values West of the meridian should also be supplied as negative values. Both latitude and longitude should not be entered as deg,min,sec but as their decimal equivalent, e.g. 30 deg 12 min 22.432 sec should be entered as 30.2062311
243
244 The ellipsoid value should correspond to one of the numbers above, e.g. to use WGS-84, the ellipsoid value should be 23
245
246 For latitude 57deg 49min 59.000sec North
247 longitude 02deg 47min 20.226sec West
248
249 using WGS84 (Ellipsoid 23)
250
251 ($mgrs)=latlon_to_mgrs(23,57.8030590197684,-2.788956799)
252
253 returns
254
255 $mgrs = 30VWK1254306804
256
257 mgrs_to_latlon
258
259 Reversing the above example,
260
261 ($latitude,$longitude)=mgrs_to_latlon(23,'30VWK1254306804')
262
263 returns
264
265 $latitude = 57.8030590197684
266 $longitude = -2.788956799645
267
268 mgrs_to_utm
269
270 Similarly it is possible to convert MGRS directly to UTM
271
272
273 AUTHOR
274 Graham Crookham, [email protected]
275
276 THANKS
277 Thanks go to the following:
278
279 Felipe Mendonca Pimenta for helping out with the Southern hemisphere
280 testing.
281
282 Michael Slater for discovering the Escape \Q bug.
283
284 Mark Overmeer for the ellipsoid_info routines and code review.
285
286 Lok Yan for the >72deg. N bug.
287
288 Salvador Fandino for the forced zone UTM and additional tests
289
290 Matthias Lendholt for modifications to MGRS calculations
291
292 Peder Stray for the short MGRS patch
293
294 COPYRIGHT
295 Copyright (c) 2000,2002,2004,2007,2010,2013 by Graham Crookham. All rights reserved.
296
297 This package is free software; you can redistribute it and/or modify it
298 under the same terms as Perl itself.
299
300