1Cartography(3) User Contributed Perl Documentation Cartography(3)
2
3
4
6 PDL::Transform::Cartography - Useful cartographic projections
7
9 # make a Mercator map of Earth
10 use PDL::Transform::Cartography;
11 $a = earth_coast();
12 $a = graticule(10,2)->glue(1,$a);
13 $t = t_mercator;
14 $w = pgwin(xs);
15 $w->lines($t->apply($a)->clean_lines());
16
18 PDL::Transform::Cartography includes a variety of useful cartographic
19 and observing projections (mappings of the surface of a sphere),
20 including reprojected observer coordinates. See PDL::Transform for
21 more information about image transforms in general.
22
23 Cartographic transformations are used for projecting not just
24 terrestrial maps, but also any nearly spherical surface including the
25 Sun, the Celestial sphere, various moons and planets, distant stars,
26 etc. They also are useful for interpreting scientific images, which
27 are themselves generally projections of a sphere onto a flat focal
28 plane (e.g. the t_gnomonic projection).
29
30 Unless otherwise noted, all the transformations in this file convert
31 from (theta,phi) coordinates on the unit sphere (e.g. (lon,lat) on a
32 planet or (RA,dec) on the celestial sphere) into some sort of projected
33 coordinates, and have inverse transformations that convert back to
34 (theta,phi). This is equivalent to working from the equidistant
35 cylindrical (or "plate caree") projection, if you are a cartography
36 wonk.
37
38 The projected coordinates are generally in units of body radii
39 (radians), so that multiplying the output by the scale of the map
40 yields physical units that are correct wherever the scale is correct
41 for that projection. For example, areas should be correct everywhere
42 in the authalic projections; and linear scales are correct along
43 meridians in the equidistant projections and along the standard
44 parallels in all the projections.
45
46 The transformations that are authalic (equal-area), conformal (equal-
47 angle), azimuthal (circularly symmetric), or perspective (true
48 perspective on a focal plane from some viewpoint) are marked. The
49 first two categories are mutually exclusive for all but the "unit
50 sphere" 3-D projection.
51
52 Extra dimensions tacked on to each point to be transformed are, in
53 general, ignored. That is so that you can add on an extra index to
54 keep track of pen color. For example, earth_coast returns a 3x<n>
55 piddle containing (lon, lat, pen) at each list location. Transforming
56 the vector list retains the pen value as the first index after the
57 dimensional directions.
58
60 Unless otherwise noted, the transformations and miscellaneous
61 information in this section are taken from Snyder & Voxland 1989: "An
62 Album of Map Projections", US Geological Survey Professional Paper
63 1453, US Printing Office (Denver); and from Snyder 1987: "Map
64 Projections - A Working Manual", US Geological Survey Professional
65 Paper 1395, US Printing Office (Denver, USA). You can obtain your own
66 copy of both by contacting the U.S. Geological Survey, Federal Center,
67 Box 25425, Denver, CO 80225 USA.
68
69 The mathematics of cartography have a long history, and the details are
70 far trickier than the broad overview. For terrestrial (and, in
71 general, planetary) cartography, the best reference datum is not a
72 sphere but an oblate ellipsoid due to centrifugal force from the
73 planet's rotation. Furthermore, because all rocky planets, including
74 Earth, have randomly placed mass concentrations that affect the
75 gravitational field, the reference gravitational isosurface (sea level
76 on Earth) is even more complex than an ellipsoid and, in general,
77 different ellipsoids have been used for different locations at the same
78 time and for the same location at different times.
79
80 The transformations in this package use a spherical datum and hence
81 include global distortion at about the 0.5% level for terrestrial maps
82 (Earth's oblateness is ~1/300). This is roughly equal to the
83 dimensional precision of physical maps printed on paper (due to
84 stretching and warping of the paper) but is significant at larger
85 scales (e.g. for regional maps). If you need more precision than that,
86 you will want to implement and use the ellipsoidal transformations from
87 Snyder 1987 or another reference work on geodesy. A good name for that
88 package would be "...::Cartography::Geodetic".
89
91 Cartographic transformations are useful for interpretation of
92 scientific images, as all cameras produce projections of the celestial
93 sphere onto the focal plane of the camera. A simple (single-element)
94 optical system with a planar focal plane generates gnomonic images --
95 that is to say, gnomonic projections of a portion of the celestial
96 sphere near the paraxial direction. This is the projection that most
97 consumer grade cameras produce.
98
99 Magnification in an optical system changes the angle of incidence of
100 the rays on the focal plane for a given angle of incidence at the
101 aperture. For example, a 10x telescope with a 2 degree field of view
102 exhibits the same gnomonic distortion as a simple optical system with a
103 20 degree field of view. Wide-angle optics typically have
104 magnification less than 1 ('fisheye lenses'), reducing the gnomonic
105 distortion considerably but introducing "equidistant azimuthal"
106 distortion -- there's no such thing as a free lunch!
107
108 Because many solar-system objects are spherical,
109 PDL::Transform::Cartography includes perspective projections for
110 producing maps of spherical bodies from perspective views. Those
111 projections are "t_vertical" and "t_perspective". They map between
112 (lat,lon) on the spherical body and planar projected coordinates at the
113 viewpoint. "t_vertical" is the vertical perspective projection given
114 by Snyder, but "t_perspective" is a fully general perspective
115 projection that also handles magnification correction.
116
118 Oblique projections rotate the sphere (and graticule) to an arbitrary
119 angle before generating the projection; transverse projections rotate
120 the sphere exactly 90 degrees before generating the projection.
121
122 Most of the projections accept the following standard options, useful
123 for making transverse and oblique projection maps.
124
125 o, origin, Origin [default (0,0,0)]
126 The origin of the oblique map coordinate system, in (old-theta, old-
127 phi) coordinates.
128
129 r, roll, Roll [default 0.0]
130 The roll angle of the sphere about the origin, measured CW from (N =
131 up) for reasonable values of phi and CW from (S = up) for
132 unreasonable values of phi. This is equivalent to observer roll
133 angle CCW from the same direction.
134
135 u, unit, Unit [default 'degree']
136 This is the name of the angular unit to use in the lon/lat
137 coordinate system.
138
139 b, B
140 The "B" angle of the body -- used for extraterrestrial maps.
141 Setting this parameter is exactly equivalent to setting the phi
142 component of the origin, and in fact overrides it.
143
144 l,L
145 The longitude of the central meridian as observed -- used for
146 extraterrestrial maps. Setting this parameter is exactly equivalent
147 to setting the theta component of the origin, and in fact overrides
148 it.
149
150 p,P
151 The "P" (or position) angle of the body -- used for extraterrestrial
152 maps. This parameter is a synonym for the roll angle, above.
153
154 bad, Bad, missing, Missing [default nan]
155 This is the value that missing points get. Mainly useful for the
156 inverse transforms. (This should work fine if set to BAD, if you
157 have bad-value support compiled in). The default nan is asin(1.2),
158 calculated at load time.
159
161 Draw a Mercator map of the world on-screen:
162
163 $w = pgwin(xs);
164 $w->lines(earth_coast->apply(t_mercator)->clean_lines);
165
166 Here, "earth_coast()" returns a 3xn piddle containing (lon, lat, pen)
167 values for the included world coastal outline; "t_mercator" converts
168 the values to projected Mercator coordinates, and "clean_lines" breaks
169 lines that cross the 180th meridian.
170
171 Draw a Mercator map of the world, with lon/lat at 10 degree intervals:
172
173 $w = pgwin(xs)
174 $a = earth_coast()->glue(1,graticule(10,1));
175 $w->lines($a->apply(t_mercator)->clean_lines);
176
177 This works just the same as the first example, except that a map
178 graticule has been applied with interline spacing of 10 degrees lon/lat
179 and inter-vertex spacing of 1 degree (so that each meridian contains
180 181 points, and each parallel contains 361 points).
181
183 Currently angular conversions are rather simpleminded. A list of
184 common conversions is present in the main constructor, which inserts a
185 conversion constant to radians into the {params} field of the new
186 transform. Something like Math::Convert::Units should be used instead
187 to generate the conversion constant.
188
189 A cleaner higher-level interface is probably needed (see the examples);
190 for example, earth_coast could return a graticule if asked, instead of
191 needing one to be glued on.
192
193 The class structure is somewhat messy because of the varying needs of
194 the different transformations. PDL::Transform::Cartography is a base
195 class that interprets the origin options and sets up the basic
196 machinery of the Transform. The conic projections have their own
197 subclass, PDL::Transform::Conic, that interprets the standard
198 parallels. Since the cylindrical and azimuthal projections are pretty
199 simple, they are not subclassed.
200
201 The perl 5.6.1 compiler is quite slow at adding new classes to the
202 structure, so it does not makes sense to subclass new transformations
203 merely for the sake of pedantry.
204
206 Copyright 2002, Craig DeForest (deforest@boulder.swri.edu). This
207 module may be modified and distributed under the same terms as PDL
208 itself. The module comes with NO WARRANTY.
209
210 The included digital world map is derived from the 1987 CIA World Map,
211 translated to ASCII in 1988 by Joe Dellinger (geojoe@freeusp.org) and
212 simplified in 1995 by Kirk Johnson (tuna@indra.com) for the program
213 XEarth. The map comes with NO WARRANTY. An ASCII version of the map,
214 and a sample PDL function to read it, may be found in the Demos
215 subdirectory of the PDL source distribution.
216
218 The module exports both transform constructors ('t_<foo>') and some
219 auxiliary functions (no leading 't_').
220
221 graticule
222 $lonlatp = graticule(<grid-spacing>,<line-segment-size>);
223
224 (Cartography) PDL constructor - generate a lat/lon grid.
225
226 Returns a grid of meridians and parallels as a list of vectors suitable
227 for sending to PDL::Graphics::PGPLOT::Window::lines for plotting. The
228 grid is in degrees in (theta, phi) coordinates -- this is (E lon, N
229 lat) for terrestrial grids or (RA, dec) for celestial ones. You must
230 then transform the graticule in the same way that you transform the
231 map.
232
233 You can attach the graticule to a vector map using the syntax:
234
235 $out = graticule(10,2)->glue(1,$map);
236
237 In array context you get back a 2-element list containing a piddle of
238 the (theta,phi) pairs and a piddle of the pen values (1 or 0) suitable
239 for calling PDL::Graphics::PGPLOT::Window::lines. In scalar context
240 the two elements are combined into a single piddle.
241
242 The pen values associated with the graticule are negative, which will
243 cause PDL::Graphics::PGPLOT::Window::lines to plot them as hairlines.
244
245 earth_coast
246 $a = earth_coast()
247
248 (Cartography) PDL constructor - coastline map of Earth
249
250 Returns a vector coastline map based on the 1987 CIA World Coastline
251 database (see author information). The vector coastline data are in
252 plate caree format so they can be converted to other projections via
253 the apply method and cartographic transforms, and are suitable for
254 plotting with the lines method in the PGPLOT output library: the first
255 dimension is (X,Y,pen) with breaks having a pen value of 0 and
256 hairlines having negative pen values. The second dimension threads
257 over all the points in the data set.
258
259 The vector map includes lines that pass through the antipodean
260 meridian, so if you want to plot it without reprojecting, you should
261 run it through clean_lines first:
262
263 $w = pgwin();
264 $w->lines(earth_coast->clean_lines); # plot plate caree map of world
265 $w->lines(earth_coast->apply(t_gnomonic))# plot gnomonic map of world
266
267 "earth_coast" is just a quick-and-dirty way of loading the file
268 "earth_coast.vec.fits" that is part of the normal installation tree.
269
270 earth_image
271 $rgb = earth_image()
272
273 (Cartography) PDL constructor - RGB pixel map of Earth
274
275 Returns an RGB image of Earth based on data from the MODIS instrument
276 on the NASA EOS/Terra satellite. (You can get a full-resolution image
277 from <http://earthobservatory.nasa.gov/Newsroom/BlueMarble/>). The
278 image is a plate caree map, so you can convert it to other projections
279 via the map method and cartographic transforms.
280
281 This is just a quick-and-dirty way of loading the earth-image files
282 that are distributed along with PDL.
283
284 clean_lines
285 $a = clean_lines(t_mercator->apply(scalar(earth_coast())));
286 $a = clean_lines($line_pen, [threshold]);
287 $a = $lines->clean_lines;
288
289 (Cartography) PDL method - remove projection irregularities
290
291 "clean_lines" massages vector data to remove jumps due to singularities
292 in the transform.
293
294 In the first (scalar) form, $line_pen contains both (X,Y) points and
295 pen values suitable to be fed to lines: in the second (list) form,
296 $lines contains the (X,Y) points and $pen contains the pen values.
297
298 "clean_lines" assumes that all the outline polylines are local -- that
299 is to say, there are no large jumps. Any jumps larger than a threshold
300 size are broken by setting the appropriate pen values to 0.
301
302 The "threshold" parameter sets the relative size of the largest jump,
303 relative to the map range (as determined by a min/max operation). The
304 default size is 0.1.
305
306 NOTES
307
308 This almost never catches stuff near the apex of cylindrical maps,
309 because the anomalous vectors get arbitrarily small. This could be
310 improved somewhat by looking at individual runs of the pen and using a
311 relative length scale that is calibrated to the rest of each run. it
312 is probably not worth the computational overhead.
313
314 t_unit_sphere
315 $t = t_unit_sphere(<options>);
316
317 (Cartography) 3-D globe projection (conformal; authalic)
318
319 This is similar to the inverse of t_spherical, but the inverse
320 transform projects 3-D coordinates onto the unit sphere, yielding only
321 a 2-D (lon/lat) output. Similarly, the forward transform deprojects
322 2-D (lon/lat) coordinates onto the surface of a unit sphere.
323
324 The cartesian system has its Z axis pointing through the pole of the
325 (lon,lat) system, and its X axis pointing through the equator at the
326 prime meridian.
327
328 Unit sphere mapping is unusual in that it is both conformal and
329 authalic. That is possible because it properly embeds the sphere in
330 3-space, as a notional globe.
331
332 This is handy as an intermediate step in lots of transforms, as
333 Cartesian 3-space is cleaner to work with than spherical 2-space.
334
335 Higher dimensional indices are preserved, so that "rider" indices (such
336 as pen value) are propagated.
337
338 There is no oblique transform for t_unit_sphere, largely because it's
339 so easy to rotate the output using t_linear once it's out into
340 Cartesian space. In fact, the other projections implement oblique
341 transforms by wrapping t_linear with t_unit_sphere.
342
343 OPTIONS:
344
345 radius, Radius (default 1.0)
346 The radius of the sphere, for the inverse transform. (Radius is
347 ignored in the forward transform). Defaults to 1.0 so that the
348 resulting Cartesian coordinates are in units of "body radii".
349
350 t_rot_sphere
351 $t = t_rot_sphere({origin=>[<theta>,<phi>],roll=>[<roll>]});
352
353 (Cartography) Generate oblique projections
354
355 You feed in the origin in (theta,phi) and a roll angle, and you get
356 back out (theta', phi') coordinates. This is useful for making oblique
357 or transverse projections: just compose t_rot_sphere with your
358 favorite projection and you get an oblique one.
359
360 Most of the projections automagically compose themselves with
361 t_rot_sphere if you feed in an origin or roll angle.
362
363 t_rot_sphere converts the base plate caree projection (straight lon,
364 straight lat) to a Cassini projection.
365
366 OPTIONS
367
368 STANDARD POSITIONAL OPTIONS
369
370 t_orthographic
371 $t = t_orthographic(<options>);
372
373 (Cartography) Ortho. projection (azimuthal; perspective)
374
375 This is a perspective view as seen from infinite distance. You can
376 specify the sub-viewer point in (lon,lat) coordinates, and a rotation
377 angle of the map CW from (north=up). This is equivalent to specify
378 viewer roll angle CCW from (north=up).
379
380 t_orthographic is a convenience interface to t_unit_sphere -- it is
381 implemented as a composition of a t_unit_sphere call, a rotation, and a
382 slice.
383
384 [*] In the default case where the near hemisphere is mapped, the
385 inverse exists. There is no single inverse for the whole-sphere case,
386 so the inverse transform superimposes everything on a single
387 hemisphere. If you want an invertible 3-D transform, you want
388 t_unit_sphere.
389
390 OPTIONS
391
392 STANDARD POSITIONAL OPTIONS
393 m, mask, Mask, h, hemisphere, Hemisphere [default 'near']
394 The hemisphere to keep in the projection (see
395 PDL::Transform::Cartography).
396
397 NOTES
398
399 Alone of the various projections, this one does not use t_rot_sphere to
400 handle the standard options, because the cartesian coordinates of the
401 rotated sphere are already correctly projected -- t_rot_sphere would
402 put them back into (theta', phi') coordinates.
403
404 t_caree
405 $t = t_caree(<options>);
406
407 (Cartography) Plate Caree projection (cylindrical; equidistant)
408
409 This is the simple Plate Caree projection -- also called a "lat/lon
410 plot". The horizontal axis is theta; the vertical axis is phi. This
411 is a no-op if the angular unit is radians; it is a simple scale
412 otherwise.
413
414 OPTIONS
415
416 STANDARD POSITIONAL OPTIONS
417 s, std, standard, Standard (default 0)
418 The standard parallel where the transformation is conformal.
419 Conformality is achieved by shrinking of the horizontal scale to
420 match the vertical scale (which is correct everywhere).
421
422 t_mercator
423 $t = t_mercator(<options>);
424
425 (Cartography) Mercator projection (cylindrical; conformal)
426
427 This is perhaps the most famous of all map projections: meridians are
428 mapped to parallel vertical lines and parallels are unevenly spaced
429 horizontal lines. The poles are shifted to +/- infinity. The output
430 values are in units of globe-radii for easy conversion to kilometers;
431 hence the horizontal extent is -pi to pi.
432
433 You can get oblique Mercator projections by specifying the "origin" or
434 "roll" options; this is implemented via t_rot_sphere.
435
436 OPTIONS
437
438 STANDARD POSITIONAL OPTIONS
439 c, clip, Clip (default 75 [degrees])
440 The north/south clipping boundary of the transformation. Because
441 the poles are displaced to infinity, many applications require a
442 clipping boundary. The value is in whatever angular unit you set
443 with the standard 'units' option. The default roughly matches
444 interesting landforms on Earth. For no clipping at all, set b=>0.
445 For asymmetric clipping, use a 2-element list ref or piddle.
446
447 s, std, Standard (default 0)
448 This is the parallel at which the map has correct scale. The scale
449 is also correct at the parallel of opposite sign.
450
451 t_utm
452 $t = t_utm(<zone>,<options>);
453
454 (Cartography) Universal Transverse Mercator projection (cylindrical)
455
456 This is the internationally used UTM projection, with 2 subzones
457 (North/South). The UTM zones are parametrized individually, so if you
458 want a Zone 30 map you should use "t_utm(30)". By default you get the
459 northern subzone, so that locations in the southern hemisphere get
460 negative Y coordinates. If you select the southern subzone (with the
461 "subzone=>-1" option), you get offset southern UTM coordinates.
462
463 The 20-subzone military system is not yet supported. If/when it is
464 implemented, you will be able to enter "subzone=>[a-t]" to select a N/S
465 subzone.
466
467 Note that UTM is really a family of transverse Mercator projections
468 with different central meridia. Each zone properly extends for six
469 degrees of longitude on either side of its appropriate central
470 meridian, with Zone 1 being centered at -177 degrees longitude (177
471 west). Properly speaking, the zones only extend from 80 degrees south
472 to 84 degrees north; but this implementation lets you go all the way to
473 90 degrees. The default UTM coordinates are meters. The origin for
474 each zone is on the equator, at an easting of -500,000 meters.
475
476 The default output units are meters, assuming that you are wanting a
477 map of the Earth. This will break for bodies other than Earth (which
478 have different radii and hence different conversions between lat/lon
479 angle and meters).
480
481 The standard UTM projection has a slight reduction in scale at the
482 prime meridian of each zone: the transverse Mercator projection's
483 standard "parallels" are 180km e/w of the central meridian. However,
484 many Europeans prefer the "Gauss-Kruger" system, which is virtually
485 identical to UTM but with a normal tangent Mercator (standard parallel
486 on the prime meridian). To get this behavior, set "gk=>1".
487
488 Like the rest of the PDL::Transform::Cartography package, t_utm uses a
489 spherical datum rather than the "official" ellipsoidal datums for the
490 UTM system.
491
492 This implementation was derived from the rather nice description by
493 Denis J. Dean, located on the web at:
494 http://www.cnr.colostate.edu/class_info/nr502/lg3/datums_coordinates/utm.html
495
496 OPTIONS
497
498 STANDARD OPTIONS
499 (No positional options -- Origin and Roll are ignored)
500
501 ou, ounit, OutputUnit (default 'meters')
502 (This is likely to become a standard option in a future release) The
503 unit of the output map. By default, this is 'meters' for UTM, but
504 you may specify 'deg' or 'km' or even (heaven help us) 'miles' if
505 you prefer.
506
507 sz, subzone, SubZone (default 1)
508 Set this to -1 for the southern hemisphere subzone. Ultimately you
509 should be able to set it to a letter to get the corresponding
510 military subzone, but that's too much effort for now.
511
512 gk, gausskruger (default 0)
513 Set this to 1 to get the (European-style) tangent-plane Mercator
514 with standard parallel on the prime meridian. The default of 0
515 places the standard parallels 180km east/west of the prime meridian,
516 yielding better average scale across the zone. Setting gk=>1 makes
517 the scale exactly 1.0 at the central meridian, and >1.0 everywhere
518 else on the projection. The difference in scale is about 0.3%.
519
520 t_sin_lat
521 $t = t_sin_lat(<options>);
522
523 (Cartography) Cyl. equal-area projection (cyl.; authalic)
524
525 This projection is commonly used in solar Carrington plots; but not
526 much for terrestrial mapping.
527
528 OPTIONS
529
530 STANDARD POSITIONAL OPTIONS
531 s,std, Standard (default 0)
532 This is the parallel at which the map is conformal. It is also
533 conformal at the parallel of opposite sign. The conformality is
534 achieved by matched vertical stretching and horizontal squishing (to
535 achieve constant area).
536
537 t_sinusoidal
538 $t = t_sinusoidal(<options>);
539
540 (Cartography) Sinusoidal projection (authalic)
541
542 Sinusoidal projection preserves the latitude scale but scales longitude
543 according to sin(lat); in this respect it is the companion to
544 t_sin_lat, which is also authalic but preserves the longitude scale
545 instead.
546
547 OPTIONS
548
549 STANDARD POSITIONAL OPTIONS
550
551 t_conic
552 $t = t_conic(<options>)
553
554 (Cartography) Simple conic projection (conic; equidistant)
555
556 This is the simplest conic projection, with parallels mapped to
557 equidistant concentric circles. It is neither authalic nor conformal.
558 This transformation is also referred to as the "Modified Transverse
559 Mercator" projection in several maps of Alaska published by the USGS;
560 and the American State of New Mexico re-invented the projection in 1936
561 for an official map of that State.
562
563 OPTIONS
564
565 STANDARD POSITIONAL OPTIONS
566 s, std, Standard (default 29.5, 45.5)
567 The locations of the standard parallel(s) (where the cone intersects
568 the surface of the sphere). If you specify only one then the other
569 is taken to be the nearest pole. If you specify both of them to be
570 one pole then you get an equidistant azimuthal map. If you specify
571 both of them to be opposite and equidistant from the equator you get
572 a Plate Caree projection.
573
574 t_albers
575 $t = t_albers(<options>)
576
577 (Cartography) Albers conic projection (conic; authalic)
578
579 This is the standard projection used by the US Geological Survey for
580 sectionals of the 50 contiguous United States of America.
581
582 The projection reduces to the Lambert equal-area conic (infrequently
583 used and not to be confused with the Lambert conformal conic,
584 t_lambert!) if the pole is used as one of the two standard parallels.
585
586 Notionally, this is a conic projection onto a cone that intersects the
587 sphere at the two standard parallels; it works best when the two
588 parallels straddle the region of interest.
589
590 OPTIONS
591
592 STANDARD POSITIONAL OPTIONS
593 s, std, standard, Standard (default (29.5,45.5))
594 The locations of the standard parallel(s). If you specify only one
595 then the other is taken to be the nearest pole and a Lambert Equal-
596 Area Conic map results. If you specify both standard parallels to
597 be the same pole, then the projection reduces to the Lambert
598 Azimuthal Equal-Area map as aq special case. (Note that t_lambert
599 is Lambert's Conformal Conic, the most commonly used of Lambert's
600 projections.)
601
602 The default values for the standard parallels are those chosen by
603 Adams for maps of the lower 48 US states: (29.5,45.5). The USGS
604 recommends (55,65) for maps of Alaska and (8,18) for maps of Hawaii
605 -- these latter are chosen to also include the Canal Zone and
606 Philippine Islands farther south, which is why both of those
607 parallels are south of the Hawaiian islands.
608
609 The transformation reduces to the cylindrical equal-area (sin-lat)
610 transformation in the case where the standard parallels are opposite
611 and equidistant from the equator, and in fact this is implemented by
612 a call to t_sin_lat.
613
614 t_lambert
615 $t = t_lambert(<options>);
616
617 (Cartography) Lambert conic projection (conic; conformal)
618
619 Lambert conformal conic projection is widely used in aeronautical
620 charts and state base maps published by the USA's FAA and USGS. It's
621 especially useful for mid-latitude charts. In particular, straight
622 lines approximate (but are not exactly) great circle routes of up to ~2
623 radians.
624
625 The default standard parallels are 33 and 45 to match the USGS state
626 1:500,000 base maps of the United States. At scales of 1:500,000 and
627 larger, discrepancies between the spherical and ellipsoidal projections
628 become important; use care with this projection on spheres.
629
630 OPTIONS
631
632 STANDARD POSITIONAL OPTIONS
633 s, std, standard, Standard (default (33,45))
634 The locations of the standard parallel(s) for the conic projection.
635 The transform reduces to the Mercator projection in the case where
636 the standard parallels are opposite and equidistant from the
637 equator, and in fact this is implemented by a call to t_mercator.
638
639 c, clip, Clip (default [-75,75])
640 Because the transform is conformal, the distant pole is displaced to
641 infinity. Many applications require a clipping boundary. The value
642 is in whatever angular unit you set with the standard 'unit' option.
643 For consistency with t_mercator, clipping works the same way even
644 though in most cases only one pole needs it. Set this to 0 for no
645 clipping at all.
646
647 t_stereographic
648 $t = t_stereographic(<options>);
649
650 (Cartography) Stereographic projection (az.; conf.; persp.)
651
652 The stereographic projection is a true perspective (planar) projection
653 from a point on the spherical surface opposite the origin of the map.
654
655 OPTIONS
656
657 STANDARD POSITIONAL OPTIONS
658 c, clip, Clip (default 120)
659 This is the angular distance from the center to the edge of the
660 projected map. The default 120 degrees gives you most of the
661 opposite hemisphere but avoids the hugely distorted part near the
662 antipodes.
663
664 t_gnomonic
665 $t = t_gnomonic(<options>);
666
667 (Cartography) Gnomonic (focal-plane) projection (az.; persp.)
668
669 The gnomonic projection projects a hemisphere onto a tangent plane. It
670 is useful in cartography for the property that straight lines are great
671 circles; and it is useful in scientific imaging because it is the
672 projection generated by a simple optical system with a flat focal
673 plane.
674
675 OPTIONS
676
677 STANDARD POSITIONAL OPTIONS
678 c, clip, Clip (default 75)
679 This is the angular distance from the center to the edge of the
680 projected map. The default 75 degrees gives you most of the
681 hemisphere but avoids the hugely distorted part near the horizon.
682
683 t_az_eqd
684 $t = t_az_eqd(<options>);
685
686 (Cartography) Azimuthal equidistant projection (az.; equi.)
687
688 Basic azimuthal projection preserving length along radial lines from
689 the origin (meridians, in the original polar aspect). Hence, both
690 azimuth and distance are correct for journeys beginning at the origin.
691
692 Applied to the celestial sphere, this is the projection made by fisheye
693 lenses; it is also the projection into which "t_vertical" puts
694 perspective views.
695
696 The projected plane scale is normally taken to be planetary radii; this
697 is useful for cartographers but not so useful for scientific observers.
698 Setting the 't=>1' option causes the output scale to shift to camera
699 angular coordinates (the angular unit is determined by the standard
700 'Units' option; default is degrees).
701
702 OPTIONS
703
704 STANDARD POSITIONAL OPTIONS
705 c, clip, Clip (default 180 degrees)
706 The largest angle relative to the origin. Default is the whole
707 sphere.
708
709 t_az_eqa
710 $t = t_az_eqa(<options>);
711
712 (Cartography) Azimuthal equal-area projection (az.; auth.)
713
714 OPTIONS
715
716 STANDARD POSITIONAL OPTIONS
717 c, clip, Clip (default 180 degrees)
718 The largest angle relative to the origin. Default is the whole
719 sphere.
720
721 t_aitoff
722 t_hammer
723 (Cartography) Hammer/Aitoff elliptical projection (az.; auth.)
724
725 The Hammer/Aitoff projection is often used to display the Celestial
726 sphere. It is mathematically related to the Lambert Azimuthal Equal-
727 Area projection (t_az_eqa), and maps the sphere to an ellipse of unit
728 eccentricity, with vertical radius sqrt(2) and horizontal radius of 2
729 sqrt(2).
730
731 OPTIONS
732
733 STANDARD POSITIONAL OPTIONS
734
735 t_vertical
736 $t = t_vertical(<options>);
737
738 (Cartography) Vertical perspective projection (az.; persp.)
739
740 Vertical perspective projection is a generalization of gnomonic and
741 stereographic projection, and a special case of perspective projection.
742 It is a projection from the sphere onto a focal plane at the camera
743 location.
744
745 OPTIONS
746
747 STANDARD POSITIONAL OPTIONS
748 m, mask, Mask, h, hemisphere, Hemisphere [default 'near']
749 The hemisphere to keep in the projection (see
750 PDL::Transform::Cartography).
751
752 r0, R0, radius, d, dist, distance [default 2.0]
753 The altitude of the focal plane above the center of the sphere. The
754 default places the point of view one radius above the surface.
755
756 t, telescope, Telescope, cam, Camera (default '')
757 If this is set, then the central scale is in telescope or camera
758 angular units rather than in planetary radii. The angular units are
759 parsed as with the normal 'u' option for the lon/lat specification.
760 If you specify a non-string value (such as 1) then you get
761 telescope-frame radians, suitable for working on with other
762 transformations.
763
764 f, fish, fisheye (default '')
765 If this is set then the output is in azimuthal equidistant
766 coordinates instead of in tangent-plane coordinates. This is a
767 convenience function for '(t_az_eqd) x !(t_gnomonic) x
768 (t_vertical)'.
769
770 t_perspective
771 $t = t_perspective(<options>);
772
773 (Cartography) Arbitrary perspective projection
774
775 Perspective projection onto a focal plane from an arbitrary location
776 within or without the sphere, with an arbitary central look direction,
777 and with correction for magnification within the optical system.
778
779 In the forward direction, t_perspective generates perspective views of
780 a sphere given (lon/lat) mapping or vector information. In the reverse
781 direction, t_perspective produces (lon/lat) maps from aerial or distant
782 photographs of spherical objects.
783
784 Viewpoints outside the sphere treat the sphere as opaque by default,
785 though you can use the 'm' option to specify either the near or far
786 surface (relative to the origin). Viewpoints below the surface treat
787 the sphere as transparent and undergo a mirror reversal for consistency
788 with projections that are special cases of the perspective projection
789 (e.g. t_gnomonic for r0=0 or t_stereographic for r0=-1).
790
791 Magnification correction handles the extra edge distortion due to
792 higher angles between the focal plane and focused rays within the
793 optical system of your camera. If you do not happen to know the
794 magnification of your camera, a simple rule of thumb is that the
795 magnification of a reflective telescope is roughly its focal length
796 (plate scale) divided by its physical length; and the magnification of
797 a compound refractive telescope is roughly twice its physical length
798 divided by its focal length. Simple optical sytems with a single optic
799 have magnification = 1. Fisheye lenses have magnification < 1.
800
801 This transformation was derived by direct geometrical calculation
802 rather than being translated from Voxland & Snyder.
803
804 OPTIONS
805
806 STANDARD POSITIONAL OPTIONS
807 As always, the 'origin' field specifies the sub-camera point on the
808 sphere.
809
810 The 'roll' option is the roll angle about the sub-camera point, for
811 consistency with the other projectons.
812
813 p, ptg, pointing, Pointing (default (0,0,0))
814 The pointing direction, in (horiz. offset, vert. offset, roll) of
815 the camera relative to the center of the sphere. This is a
816 spherical coordinate system with the origin pointing directly at the
817 sphere and the pole pointing north in the pre-rolled coordinate
818 system set by the standard origin. It's most useful for space-based
819 images taken some distance from the body in question (e.g. images of
820 other planets or the Sun).
821
822 Be careful not to confuse 'p' (pointing) with 'P' (P angle, a
823 standard synonym for roll).
824
825 c, cam, camera, Camera (default undef)
826 Alternate way of specifying the camera pointing, using a spherical
827 coordinate system with poles at the zenith (positive) and nadir
828 (negative) -- this is useful for aerial photographs and such, where
829 the point of view is near the surface of the sphere. You specify
830 (azimuth from N, altitude from horizontal, roll from vertical=up).
831 If you specify pointing by this method, it overrides the 'pointing'
832 option, above. This coordinate system is most useful for aerial
833 photography or low-orbit work, where the nadir is not necessarily
834 the most interesting part of the scene.
835
836 r0, R0, radius, d, dist, distance [default 2.0]
837 The altitude of the point of view above the center of the sphere.
838 The default places the point of view 1 radius aboove the surface.
839 Do not confuse this with 'r', the standard origin roll angle!
840 Setting r0 < 1 gives a viewpoint inside the sphere. In that case,
841 the images are mirror-reversed to preserve the chiralty of the
842 perspective. Setting r0=0 gives gnomonic projections; setting r0=-1
843 gives stereographic projections. Setting r0 < -1 gives strange
844 results.
845
846 iu, im_unit, image_unit, Image_Unit (default 'degrees')
847 This is the angular units in which the viewing camera is calibrated
848 at the center of the image.
849
850 mag, magnification, Magnification (default 1.0)
851 This is the magnification factor applied to the optics -- it affects
852 the amount of tangent-plane distortion within the telescope. 1.0
853 yields the view from a simple optical system; higher values are
854 telescopic, while lower values are wide-angle (fisheye). Higher
855 magnification leads to higher angles within the optical system, and
856 more tangent-plane distortion at the edges of the image. The
857 magnification is applied to the incident angles themselves, rather
858 than to their tangents (simple two-element telescopes magnify
859 tan(theta) rather than theta itself); this is appropriate because
860 wide-field optics more often conform to the equidistant azimuthal
861 approximation than to the tangent plane approximation. If you need
862 more detailed control of the relationship between incident angle and
863 focal-plane position, use mag=1.0 and compose the transform with
864 something else to tweak the angles.
865
866 m, mask, Mask, h, hemisphere, Hemisphere [default 'near']
867 'hemisphere' is by analogy to other cartography methods although the
868 two regions to be selected are not really hemispheres.
869
870 f, fov, field_of_view, Field_Of_View [default 60 degrees]
871 The field of view of the telescope -- sets the crop radius on the
872 focal plane. If you pass in a scalar, you get a circular crop. If
873 you pass in a 2-element list ref, you get a rectilinear crop, with
874 the horizontal 'radius' and vertical 'radius' set separately.
875
876 EXAMPLES
877
878 Model a camera looking at the Sun through a 10x telescope from Earth
879 (~230 solar radii from the Sun), with an 0.5 degree field of view and a
880 solar P (roll) angle of 30 degrees, in February (sub-Earth solar
881 latitude is 7 degrees south). Convert a solar FITS image taken with
882 that camera to a FITS lon/lat map of the Sun with 20 pixels/degree
883 latitude:
884
885 # Define map output header (no need if you don't want a FITS output map)
886 $maphdr = {NAXIS1=>7200,NAXIS2=>3600, # Size of image
887 CTYPE1=>longitude,CTYPE2=>latitude, # Type of axes
888 CUNIT1=>deg,CUNIT2=>deg, # Unit of axes
889 CDELT1=>0.05,CDELT2=>0.05, # Scale of axes
890 CRPIX1=>3601,CRPIX2=>1801, # Center of map
891 CRVAL1=>0,CRVAL2=>0 # (lon,lat) of center
892 };
893
894 # Set up the perspective transformation, and apply it.
895 $t = t_perspective(r0=>229,fov=>0.5,mag=>10,P=>30,B=>-7);
896 $map = $im->map( $t , $maphdr );
897
898 Draw an aerial-view map of the Chesapeake Bay, as seen from a sounding
899 rocket at an altitude of 100km, looking NNE from ~200km south of
900 Washington (the radius of Earth is 6378 km; Washington D.C. is at
901 roughly 77W,38N). Superimpose a linear coastline map on a photographic
902 map.
903
904 $a = graticule(1,0.1)->glue(1,earth_coast());
905 $t = t_perspective(r0=>6478/6378.0,fov=>60,cam=>[22.5,-20],o=>[-77,36])
906 $w = pgwin(size=>[10,6],J=>1);
907 $w->fits_imag(earth_image()->map($t,[800,500],{m=>linear}));
908 $w->hold;
909 $w->lines($a->apply($t),{xt=>'Degrees',yt=>'Degrees'});
910 $w->release;
911
912 Model a 5x telescope looking at Betelgeuse with a 10 degree field of
913 view (since the telescope is looking at the Celestial sphere, r is 0
914 and this is just an expensive modified-gnomonic projection).
915
916 $t = t_perspective(r0=>0,fov=>10,mag=>5,o=>[88.79,7.41])
917
918
919
920perl v5.12.3 2009-10-17 Cartography(3)