Coyote Graphics Map Projection Routines

Date: Fri Nov 29 13:44:27 2013

single page | use frames     summary     class     fields     routine details     file attributes


top cgTerminatorMap

Graphics, Map Projections

cgTerminatorMap [, center_lon] [, center_lat] [, /FlipDay] [, Image=byte] [, Map_Projection=varies] [, OutFilename=string] [, /PNG] [, /PS] [, Time=string]

This is a program for viewing a map of the Earth in several different projections with a day/night terminator. Both the Coyote Library and the JHUAPL IDL Library are required to run the program.

The spherical geometry problems inherent with working the map projections are not completely solved in this program. The main problem seems to be that if the terminator polygon (represented in the program by the variables lon_terminus and lat_terminus) overlaps the pole regions, then stardard methods for determining if a point is inside or outside a polygon are not reliable. (*All* longitudes are inside the polygon if the polygon overlaps a pole!) In the program, this manifests itself as the sun side of the terminator appearing dark and the night side appearing light. Hence, the FLIPDAY keyword.

To some extent, this problem can be eliminated by setting the CENTER_LAT parameter to zero, at least with some map projections. I've thought about forcing it to be zero and forcing you to use well-behaved map projections, but have decided to leave the program the way it is so you can discover the limitations yourself.


center_lon in optional type=float default=0.0

The longitude, in degrees, of the center of the map, (-180 to 180).

center_lat in optional type=float default=0.0

The latitude, in degrees, of the center of the map, (-90 to 90). Latitudes other than zero can often cause problems with the terminator polygon "spilling over" into the wrong areas of the map.


FlipDay in optional type=boolean default=0

The program suffers from an inability to always correctly distinguish the "day" side of the day/night terminator. If the program gets it wrong, you can use this keyword to "flip" the day/night area. For example, here is a call that gets it wrong:

cgTeminatorMap, 0, 90.0, MAP_PROJECTION=4, time="Thu Apr 13 08:49:34 2006"

Unfortunately, you can only know if it is "wrong" by visual inspection. The sun is always placed correctly. I realize this limits the usefulness of the program, generally, but it is a limitation I am not motivated enough to fix. That is to say, the program meets my limited needs perfectly. :-)

Image out optional type=byte

Set this keyword to a named variable to return a 24-bit color image of the final result.

Map_Projection in optional type=varies default=0

Either the number or the name of one of the following map projection types.


OutFilename in optional type=string

The name of the output filename. Used only if the PS or PNG keywords are set.

PNG in optional type=boolean default=0

If this keyword is set, a PNG file is created from a PostScript intermediary file. ImageMagick must be installed for this option not to cause an error.

PS in optional type=boolean default=0

Set this keyword to create a PostScript file of the terminator image.

Time in optional type=string

A date/time string of nearly any format. The month, however, should be represented as a three-letter string. The time is written as hh:mm:ss. Examples of date/time strings are these:

'Wed Apr 12 22:39:52 2006' '12 APR 2006 04:16:00' 'Apr 12, 2006 04:16:00' 'Nov 12, 2006'

If not specified, the current day and time (from SYSTIME) is used.


To see a single day passing:

XInterAnimate, Set=[800,400,24], /ShowLoad, Title='Wednesday Nov 16, 2011' FOR j=0,23 DO BEGIN cgTerminatorMap, Time = "Wed Nov 16 " + String(j, Format='(I2.2)') + ":00:00 2011" XInterAnimate, Frame=j, Window=!D.Window ENDFOR XInterAnimate, 20 END

Author information



David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: Coyote's Guide to IDL Programming:


Copyright (c) 2006-2011, Fanning Software Consulting, Inc.


Change History:

Written by David W. Fanning, April 12, 2006. Updated to use Coyote Graphics, 6 September 2011. DWF. Algorithm reworked and improved. 13 November 2011. DWF. The map projection order seems to have gotten itself scrambled. Fixed. 1 March 2012. DWF.

File attributes

Modification date: Fri Nov 02 07:51:48 2012
Lines: 360
Docformat: rst rst