Go back to B.J.S. Cahill Resource Page
Cahill Butterfly Map 1909
Cahill 1909
Go back to Gene Keyes home page

Cahill-Keyes M-layout world map silhouette including Antarctica
Cahill-Keyes 1975

Page 7 (Addendum, 2011-01-12: Progress Report)

Cahill-Keyes Octant Graticule:
Principles and Specifications

with Perl programs and OpenOffice.org 2.0 macros
for 1/1,000,000 Megamap

Gene Keyes

15) Toward a Computerized World Coastline for the
Cahill-Keyes Octant Graticule

Latest Programming by Mary Jo Graça, "CKOG-Plus"

(Edited by Gene Keyes)

Note by GK: In my "Principles and Specifications" posting dated 2010-08-20, the first six pages of this set  I showed how Mary Jo Graça had devised two interconnected Perl programs and some OpenOffice.org Draw macros, which can output a complete Cahill-Keyes 8-octant graticule (or segments thereof), at 1/1,000,000 or less, with proportional 1° geocells, and a threefold metric grid enclosure. Since then, she has been striving to amplify the program set to explain her approach in greater detail (with six illustrations), and to incorporate world coastline data. Besides the earlier graticule,  she has now been able to do a specimen depicting the Canadian Maritime provinces of Nova Scotia and Prince Edward Island at 1/1,000,000 or smaller (using a 1/2,000,000 data segment from NOAA):
(See four samples near bottom of page.)

However, the programming still remains at an early stage, and now comprises a patchwork of three interrelated Perl programs and separate OOo macros, the latter entailing a lot of clumsy cut-and-paste of large data sets. In Mary Jo’s opinion, these remain incomplete and unready for prime time, and could all be consolidated into a much more efficient single program, perhaps written in Python, or C++, or directly into the Basic of OOo macros  so far, endeavors which are beyond her reach. Nonetheless, I want to put forward the current state of our progress, in the hope that those who are interested can streamline the scripting, and utilize other GIS data.
Below are additional materials by Mary Jo to help those interested in taking this process further, such as more efficient programming, and more elaborate GIS data for the Cahill-Keyes map.
1) Six images illustrating how global longitude - latitude data are converted to single half-octant ones, to Cartesian coordinates on the half-octant, and to coordinates on the final 8-octant Cahill-Keyes world map.

2) The Read-me describing what program "CKOG-Plus" does.

3) The Perl program itself, "CKOG-plus" (attached here as a pdf to preserve its formatting) with lots of comments which might help in converting it to other programming languages.

4) Jpegs of the Maritimes as drawn by her OOo macros (but still in an early phase, entailing cut-and-paste of several macro-runs).
The six diagrams are first, since they are mentioned in the Read-me. She produced these with OpenOffice.org Draw 2.0, and I helped with the text captions.






PS: The text of that "Supple Zone" explanation is on p. 1 of this Web set.

Note by GK: Next is Mary Jo Graça's Read-Me for her third interrelated Perl program, "CKOG-Plus", describing how she converts latitude-longitude data to the Cahill-Keyes Octant Graticule (CKOG), as well as doing a test import of Nova Scotia coastline data, from NOAA's

Program "CKOG-plus" (attached here as a pdf to preserve its formatting) has all the subs (functions and subroutines) necessary to convert any longitude - latitude point on the globe to either the 8-octant map coordinates or to those of Gene's 1-octant map coordinates (using version 8). This program could replace program "HalfOctant8"; besides converting latitude - longitude to M-map or Gene's 1-octant coordinates, it can calculate anything that earlier program calculates (except arrays dP and L, which were useful in "HalfOctant8", but are not really needed). However, program "HalfOctant8" computes the 1-degree graticule more efficiently. It calculates meridian joints for each meridian only once, and all the parallel crossings a region at a time. Program "CKOG-plus" determines the region and calculates meridian joints for each point, rather than for each meridian, because it needs to handle longitudes and latitudes that are not whole degrees when converting coastal data.

The program includes lots of comments (lines or parts of lines starting with #), such that it should be reasonably easy to follow by anyone wanting to convert it to a different language, even if they don't know Perl.

Lines 1 and 3 are necessary for Perl programs, at least those run on Linux; the first tells the computer that this program is in Perl, and the other imports the library of trigonometric commands.

Line 5 [($sin60, $cos60, $yTranslate, @Prelims) = Preliminary();] is essential for anything one might want to compute. It calculates a bunch of values (see Fig. 3 and 6) needed by other subs, and assigns them to 3 variables and one array (@Prelims). Sub Preliminary() calculates those values which are likely to be used over and over again, and are, therefore, best calculated only once. It is in this sub that points M, A, B, C, D, E, F, G, T and several lengths, including R, are calculated. Note that sub Preliminary() calculates the coordinates of point N, but does not output them, as they are not necessary for any subsequent calculation.

The remaining commands before the line with the word "S U B R O U T I N E S" (with all the spaces) were included just for the purpose of demonstrating how the subs are used. This section of the program includes several optional blocks that calculate different things. I call them the SKIP blocks. Variable $SKIP is set to "" (empty string) for the block to be executed, or to just about anything else (I use "YES") to skip it. Here's a summary of these blocks:

1 – Printing out the values returned by sub Preliminary(), except for the first three values, in a CSV (comma-separated values), or rather, a tab-separated values format which might be read by spreadsheet programs. I used this to compare with the values in the Hashes8.csv file output by program HalfOctant8.

2 – Calculating and printing out joints and ends of each whole-numbered meridian in the half-octant. These values can be used to prepare commands to draw the meridians. These are the xJ and yJ arrays listed in the Hashes8.csv file.

3 – Calculating and printing out every point in the half-octant whose longitude and latitude are whole degrees. These are the xP and yP arrays listed in the Hashes8.csv file, which can be used to draw the whole-degree parallels.

4 – Reading in a coastline data file in MAPGEN format, and converting the data first to half-octant template coordinates, and then to either Gene's one octant or eight-octant-M-map coordinates, and outputting a macro to plot the coastline using OpenOffice.org Draw. (The macro presupposes the existence of macro functions P, L, and Collect, which are in All-macros-part-1.odt,

Note that converting data from half-octant template to any octant in M-map coordinates is demonstrated in the last block. One could use the half-octant template values calculated in blocks 2 and 3, and run them through sub MJtoG() giving values 1 to 8 for variable $Octant, to calculate the graticule for the whole M-map.

Here is a list of the subroutines and of the figures that they relate to:

Sub Preliminary()  calculates values often needed for other calculations  refer to fig. 3 and fig. 6.

Subs Equator() and Joints()  used by other subroutines; these calculate meridian intersection with equator (Je) and meridian joints (Jt and Jf)  refer to fig. 4.

Sub Parallel 73()  used by subs Preliminary() and MPtoXY()  refer to fig. 6a.

Sub MPtoXY()  the conversion from meridian - parallel to x-y within the template half-octant, taking into consideration the different zones of calculation  refer to figures 5 and 6.

Subs LineIntersetion(), Length(), Interpolate(), CircleLineIntersection()  just tools used by other subroutines.

Sub LLtoMP()  converts world longitude - latitude to half-octant-template meridian - parallel  refer to fig. 1.

Sub MJtoG() and sub Rotate()  (the former sub uses the latter) convert from template to Cahill-Keyes coordinates  refer to figures 2 and 1.

The subroutines are not given in any particular order. To convert world data from longitude - latitude to Cahill-Keyes world map coordinates one would, after having called sub Preliminary() only once, call the following three subroutines once for each datum: sub LLtoMP(), sub MPtoXY() and sub MJtoG(). These subroutines call all the others.

Note by GK: Here are four very preliminary samples of coastline data absorbed into the Cahill-Keyes Octant Graticule by Mary Jo Graça's "CKOG-Plus" program, showing Prince Edward Island and Nova Scotia at scales of 1,1,000,000, 1/2,000,000, 1/5,000,000, and 1/10,000,000. These are screen-shot jpegs by Gene Keyes from OpenOffice.org Draw 2.0 on an Asus eee 701 4G netbook and a 17" monitor. The scales are only approximate, due to monitor distortion, as well as differing sizes of my monitors, and yours. Pdf's would give a more accurate printout, but those will be deferred till a more advanced state of the project. As mentioned above, the right angle dark line shows content of the map if printed at 1/1,000,000 on 8.5 x 11" paper; and the data source is a 1/2,000,000 segment from NOAA):
Nota bene: the point of this exercise is to imagine the entire world map at these scales! And in such a regular graticule! Then to do a complete version . . .

PEI & NS, 1/1M

PEI & NS, 1/2,000,000

PEI & NS, 1/5M

PEI & NS, 1/10 M

Reprise of Contents


Fundamental considerations

X-Y coordinates by hand or computer

Orientation, hand-drawn

Orientation, computer-drawn

Coordinates for hand-drawn version of octant perimeter

Constructing meridians and parallels in the
Cahill-Keyes Octant Graticule

Further explanation of the "supple zones"

Latitude lengths per 1 and 5 degrees in
Cahill-Keyes Octant Graticule
(central and outer meridians)

Constructing the Cahill-Keyes Octant Graticule
and Megamap with Perl programming
and OpenOffice.org Draw macros

Perl Program "HalfOctant8" by Mary Jo Graça
to calculate one-degree coordinates
for Cahill-Keyes Octant Graticule Template
(including scaffold triangle and octant itself)

Complete x-y coordinates for
Cahill-Keyes Octant Graticule Template
(and 1/1,000,000 Megamap)

Perl program "OOmacroMaker4" by Mary Jo Graça
to produce OpenOffice.org Draw macros
for Cahill-Keyes Octant Graticule

OpenOffice.org (OOo) macros via Perl
for Cahill-Keyes Octant Graticule and Megamap

Cahill-Keyes Octant Graticule
and Megamap Grid as
illustrated from OOo macros

Toward a Computerized World Coastline for the
Cahill-Keyes Octant Graticule:
Latest Programming by Mary Jo 
Graça, "CKOG-Plus"

Comments or suggestions or streamlining or other programs or programming approaches are more than welcome:  

Go back to page 1
  page 2   page 3   page 4   page 5  page 6
Go back to B.J.S. Cahill Resource Page
Go back to Gene Keyes home page