Nemo mini-library - introduction and purpose

The natural domain of all geographical data is isometric, finite and boundless spheroidal surface of the planet Earth. This is why it is frequently both easier and more useful to build a digital globe, then it is to build a digital map:

The traditional method of geographic coordinate recording consists of angular φ and λ (latitude and longitude, respectively). This coordinate form is ill-suited for processing on a digital computer. Specifically, the implementer of any application that handles large volumes of wide area geographic data must find a solution to three fundamental software engineering problems:

• Geographic coordinates, φ and λ, are numerical representation of location on a surface on an ellipsoid of rotation. Formulae that describe its surface geometry relationships are typically derived from differential equations by their polynomial expansion. These tend to be very costly to evaluate on a computer.

• Geographic coordinates on spheroidal (i.e., a "sphere-like" body - whether an ellipsoid or a sphere) surface are traditionally recorded as angular values. Numerical operations on angles require frequent evaluation of trigonometric functions (sine, cosine...), also a costly operation when compared to four algebraic operations (addition, subtraction, multiplication and division).

• If either angular (2 elements) or vector (3 elements) coordinates of a point on the spheroidal surface are recorded as an 8-byte "floating point" number each, the volume of coordinate data can become quite high, yet the granularity of location recorded in such manner exceeds by orders of magnitude the spatial precision of any common geographical data, and the precision requirements of any application. In addition, such high granularity forces the developer to burden the application with some form of "epsilon control mechanism", i.e., a test that determines when two points are coincident despite the fact their numerical coordinates are not identical.

Nemo mini-library is a collection of C-language functions, that provides a path to the solution of those problems. It may work effectively for a large number of different geographical applications.

• Spatial relationships are initially evaluated on an ellipsoid-specific near-conformal sphere, and the refinement that brings the solution to ellipsoid geometry precision level can be performed only when and if necessary.

• Once data is ingested from conventional geographic coordinates (ellipsoid φ and λ), it is transformed to the near-conformal spherical domain, and internally recorded not as two angles, but as three direction cosines. This restricts the evaluation of trigonometric functions to only those segments of the code that exchanges data with humans or other applications that insist on conventional ellipsoidal φ and λ coordinates.

• High-volume coordinate data is transformed into a concise vector ("concise direction cosine", CDC) form, which encodes a position on the spheroidal surface as an 8-byte integer. The resolution of this planet-wide CDC integer "grid", on the surface of a spheroid the size of Earth is 21 mm maximum, and 6 mm average. Since the point coordinates are encoded as integers, in many application contexts points can be simply considered coincident when their CDC coordinates are equal.

The approach to geographic data representation outlined above provides a sound foundation for implementation of complex, multi-point data objects (multi-point sets, lines, surface areas) and of spatial sorting and searching - both the subject of a different software package (currently under development) from which Nemo mini-library is an excerpt.

This web-page is only a brief outline; the distribution archive includes additional documents and external references. There are also detailed preambles and in-line commentary in each library source code file.

The use of the Nemo mini-library is governed by a BSD-style license, the text of which is included in the distribution archive.

The library is distributed as a .tar archive. There is no "version control" other than a 6-digit (YYMMDD) publication date numeric string in the file name.

Download the library archive (905.1 kB): [nemo-minilib-221007.tar.gz].