# Equirectangular projection

## Wiki2Reveal

This learning resource can be used as Wiki2Reveal slides in mathematics courses as introduction to projective geometry.

## Introduction

In this learning resource the generation of an equirectangular projection is the objective. The learning resource is use-case driven, AFrame Example Durlach is the first use-case of equirectangular projection. Look around by dragging the direction of view with the mouse with left mouse button pressed.

Preview of the equirectangular projection in AFrame - Drag the preview of the equirectangular image with your mouse button pressed.

### Example of the equirectangular image

Preview the equirectangular JPG-image and explore the distortion of the image at the top and the bottom of the rectangular JPEG image.

### Navigation with multiple equirectangular images

The AFrame Navigation example from the river Rhine in Germany allows to jump from one location at the river rhine to another location at to the equirectangular preview.

### Equirectangular Projection for Maps

The following image shows an equirectangular projection of the world. The standard parallel is the equator (plate carrée projection)

### Distortion

Equirectangular projection with Tissot's indicatrix of deformation and with the standard parallels lying on the equator. The deformation of a circle into an ellipse is visible on different location the world map.

### Deformation of a Circle - Distortion Indicator

The deformation of the circle is an indicator for the distortion of the image.

### Areas of Interest

In the image above the distortion in the planar projection is

• minimal close to the equator and
• maximal at the south pole and north pole.

Rotating circle over the equator (e.g. intersecting with North and South Pole) can be used to have projections with minimal distortion in the area of interest.

### North Pole and South Pole

The strongest distortion can be found at the north pole and south pole in the following true-colour satellite image of the earth. In the equirectangular projection the top horizontal line of pixels represent the single pixel for the north pole on the sphere model of the earth. Similar to that the south pole as one pixel is stretched out bottom line of pixels in the equirectangular projection.

## Use-Case

From a set of standard images of the camera covering a full the from center point of view. In general you cover 360 degree circle with rectangular standard images and you take image with camera for the sky and the floor (preferred without seeing the tripod that might be used for the other images). These set of images are aggregate in one equirectangular image representing a full spheric panorama image, that be be viewed e.g. in Aframe or other panoramic OpenSource viewes, that support equirectangular images.

### EQUI2SPH Projection

The underlying type of projection is an equirectangular projection EQUI2SPH, that is used e.g in geographical context, where a sphere is projected to rectangular plane on the map. First of all we explore the use-case in 3D Modelling about the spherical use of an spherical panorama image.

## Distortion

The projection creates especially at the "North Pole" and the "South Pole" the heaviest distortion in comparison to distances measured on the surface of the sphere. For panoramic views the distortion is just a matter of storage of the spheric pixel information in a rectangular format. On the image of a market place you will see that the panoramic viewes transfer the rectangular images into a natural view where you can look around and explore the location from different angles and with multiple equirectangular images from many locations (see river Rhine example Cologne).

## Origin of Terminology and History

The equirectangular projection (also called the equidistant cylindrical projection), and which includes the special case of the plate carrée projection (also called the geographic projection, lat/lon projection, or plane chart), is a simple map projection attributed to Marinus of Tyre, who Ptolemy claims invented the projection about AD 100.[1] The projection maps meridians to vertical straight lines of constant spacing (for meridional intervals of constant spacing), and circles of latitude to horizontal straight lines of constant spacing (for constant intervals of parallels). The projection is neither equal area nor conformal.

### Implications of Distortion for Navigation

Because of the distortions introduced by this projection, it has little use in navigation or cadastral mapping and finds its main use in thematic mapping.

### Application in global Raster Datasets

In particular, the plate carrée has become a standard for global raster datasets, such as Celestia, NASA World Wind, the USGS Astrogeology Research Program, and Natural Earth, because of the particularly simple relationship between the position of an image pixel on the map and its corresponding geographic location on Earth or other spherical solar system bodies.

### Application in panoramic photography

In addition it is frequently used in panoramic photography to represent a spherical panoramic image.[2]

## Definition - Equirectangular Projection

• (SPH2EQUI) The forward projection transforms spherical coordinates into planar coordinates of the equirectangular projection.
• (EQUI2SPH) The reverse projection transforms equirectangular coordinates from the plane back onto the sphere. The formulae presume a spherical model

### Spherical - Longitude and Latitude - SPH

• Longitude ${\displaystyle \lambda \in [-180^{\circ },+180^{\circ }]}$
• Latitude ${\displaystyle \phi \in [-90^{\circ },+90^{\circ }]}$

### Visualization

A perspective view of the Earth showing how latitude (${\displaystyle \phi }$ ) and longitude (${\displaystyle \lambda }$ ) are defined on a spherical model. The graticule spacing is 10 degrees.

#### Longitude - SPH

Longitude is given as an angular measurement referring to the 0° Greenich Meridian as the Prime Meridian and is ranging to ${\displaystyle +180^{o}}$  eastward and ${\displaystyle -180^{o}}$  westward. The Greek letter ${\displaystyle \lambda }$  (lambda)[3][4] is used to denote the location of a place on Earth east or west of the Prime Meridian

#### Latitude - SPH

Latitude is given as an angular measurement referring to the 0° Equator and is ranging to ${\displaystyle +90^{o}}$  towards the North Pole and ${\displaystyle -90^{o}}$  towards the South Pole. The Greek letter ${\displaystyle \phi }$  or ${\displaystyle \varphi }$  (phi) denotes that angle.

#### Mnemonic - Greek Letter - Phi

There are two different notations of the greek letter ${\displaystyle \phi }$  and ${\displaystyle \varphi }$ . In this learning resource the notation ${\displaystyle \phi }$  is used to indicate that it denotes the angle at circle that intersects with the North Pole and the South Pole.

### Definition of Spherical Variables

The projections are mathematical function/mappings. For definition of these projections the following variables are defined:

• ${\displaystyle \lambda }$  is the longitude of the location to project;
• ${\displaystyle \phi }$  is the latitude of the location to project;
• ${\displaystyle \phi _{1}}$  are the standard parallels (north and south of the equator) where the scale of the projection is true;
• ${\displaystyle \phi _{0}}$  is the central parallel of the map (e.g. ${\displaystyle \phi _{0}=0^{\circ }}$  equator);
• ${\displaystyle \lambda _{0}}$  is the central meridian of the map;
• ${\displaystyle R}$  is the radius of the globe.

Longitude and latitude variables are defined here in terms of radians.

### Definition of Equirectangular Planar Variables - EQUI

• ${\displaystyle x_{e}}$  is the horizontal coordinate of the projected location on the map;
• ${\displaystyle y_{e}}$  is the vertical coordinate of the projected location on the map;

### Forward Projection - Spherical to Planar - SPH2EQUI

{\displaystyle {\begin{aligned}x&=R\cdot (\lambda -\lambda _{0})\cdot \cos(\phi _{1})\\y&=R\cdot (\phi -\phi _{0})\end{aligned}}}

### Special Case - Forward Projection

The plate carrée (French, for flat square),[5] is the special case where ${\displaystyle \varphi _{1}}$  is zero. This projection maps x to be the value of the longitude and y to be the value of the latitude,[6] and therefore is sometimes called the latitude/longitude or lat/lon(g) projection.

When the ${\displaystyle \phi _{1}}$  is not zero, such as Marinus's ${\displaystyle \phi _{1}=36}$ ,[7] or Ronald Miller's ${\displaystyle \phi _{1}=(37.5,43.5,50.5)}$ ,[8] the projection can portray particular latitudes of interest at true scale.

### Remarks - Ellipsoidal Model

While a projection with equally spaced parallels is possible for an ellipsoidal model, it would no longer be equidistant because the distance between parallels on an ellipsoid is not constant. More complex formulae can be used to create an equidistant map whose parallels reflect the true spacing.

### Reverse - Planar to Spherical - EQUI2SPH

{\displaystyle {\begin{aligned}\lambda &={\frac {x}{R\cdot \cos(\phi _{1})}}+\lambda _{0}\\\phi &={\frac {y}{R}}+\phi _{0}\end{aligned}}}

### Alternative names

In spherical panorama viewers, usually:

• ${\displaystyle \lambda }$  is called "yaw";[9]
• ${\displaystyle \phi }$  is called "pitch";[10]

where both are defined in degrees.

## Learning Activities

The following learning activities address Projective Geometry from a standard snapshot taken with your camera onto an area on the sphere according to the equirectangular projection. Keep in mind to distinguish between the following projective converters:

• (SPH2EQUI / EQUI2SPH): (Latitude,Longitude) coordinates sphere ${\displaystyle \Longleftrightarrow }$  ${\displaystyle (x_{e},y_{e})}$  coordinates of an equirectangular image
• (SPH2IMG / IMG2SPH): ${\displaystyle (x_{e},y_{e})}$  equirectangular coordinates ${\displaystyle \Longleftrightarrow }$  ${\displaystyle (x,y)}$  coordinates standard image of your smartphone or camera.
• (EQUI2IMG / IMG2EQUI): (Latitude,Longitude) coordinates sphere ${\displaystyle \Longleftrightarrow }$  ${\displaystyle (x,y)}$  coordinates standard image of your smartphone or camera.

### Angle of View

For the learning activities it is important to understand the

• (HAV) Horizontal Angle of View in landscape format and
• (VAV) Vertical Angle of View in landscape format.

### Learning Task - Angle of View

The HAV and VAV differ from camera to camera. Explain why the HAV and VAV are relevant for the calculation of IMG2EQUI projection. Use the following figure to explain the requirements for projection.

### Visualization of Angle of View

The following figure depicts besides the Horizontal (HAV) and Vertical Angle of View (VAV) also the Diagonal Angle of View (DAV).

### Remark - IMG2EQUI Projection

The current projection type of the learning activities is the (IMG2EQUI) projection between the ${\displaystyle (x,y)}$  coordinates of a standard image and the distorted ${\displaystyle (x_{e},y_{e})}$  coordinates of an equirectangular image and vice verca.

### HAV and VAV as camera specifc properties

Due to the fact that different cameras have different angles of view (HAV and VAV) the visible area of the standard image (taken with your smartphone) might vary. The following animation shows different horizontal angles of view (HAV) e.g. for taking a snapshot vertically upwards towards the sky or blue ceiling.

### IMG2EQUI Projection - Polar Regions

In this learning step we take pictures with a standard camera or smartphone and want to calculate the (Latitude,Longitude) coordinates of the sphere from (x,y) coordinates of standard image created with your smartphone or camera. In the first learning step we consider the sphere at the polar regions. These regions are the most distorted areas in the equirectangular projections.

### IMG2SPH Projection - Take Snapshots for Learning Task

• Take your mobile phone and take two snapshots vertical down and vertical up from your floor and from the ceiling. Select an position in your room where the top and the floor has some visible elements (e.g. a lamp, wooden decorative elements, ...). Alternatively you can create the two images outside with a cloudy sky and objects lying on the ground.
• select a center of a circle and a radius that fits into both images (maximize the radius of the circle,
• in this module we will project these two images to the polar regions of the sphere within the rectangular coordinate system of the image.

#### Initial State - Image Sky

The following image shows the initial state taking a picture from the sky. The camera is located in the center of the red sphere and takes an image of the blue sky or the ceiling in a room. The ceiling is visualized as a blue plane. The learning task is to calculate the angles for the corresponding point on the sphere.

#### Snapshot with a Camera

The first image is snapshot with a camera taking a picture vertically upwards to the ceiling (into the sky). The red circle is the projected area from the image (sky/ceiling) onto a part of the equirectangular image visualized in the next section of the learning resource.

#### Equirectangular Projection of Circle - Rectangle

Explain, why the circle in the source image of the polar region (North Pole) is a rectangle after projection in the equirectangular image.

#### Learning Task - Function for Coordinate Transformation IMG2EQUI

We denote by ${\displaystyle P_{IMG}(x,y)}$  the color information of a pixel in the source image (IMG) and with ${\displaystyle P_{EQUI}(x_{e},y_{e})}$  the color information of the pixel in the image in the destination format (EQUI). Define the function ${\displaystyle P_{EQUI}(x_{e},y_{e})}$  by calculating the corresponding ${\displaystyle (x,y)}$  coordinates in the IMG source image. This calculation is used to set pixels in the destination format EQUI by setting

${\displaystyle P_{EQUI}(x_{e},y_{e}):=P_{IMG}(x,y).}$

Remark: You need basic knowledge in trigonometry to perform this learning task.

#### Coordinate System of Graphics

The coordinate system of an image has a different orientation in y-axis. This is shown in the diagram.

• ${\displaystyle x_{max}}$  is the maximal value of the on the x-axis of the image
• ${\displaystyle y_{max}}$  is the maximal value of the on the y-axis the of the image
• The origin of the coordinate system is on the top left.

Keep this in mind, when you use the coordinate system for your experiments with projections (see also equirectangular projection.

#### Rectangular to Sphere - Projection

Now we use a the standard rectangular image on the right as in input for the equirectangular projection on the sphere and we view the image in panoramic preview on the sphere. What can be observed, if you analyze the projected area of red ceiling and a marked green rectangle on the floor.

#### Screenshots - Projection on Sphere of the standard Image

Screenshot of projection
Ceiling/Sky Floor

#### Learning Task - Projection of Sky in Graphics Coordinate System

Graphics have an own coordinate system to display points in pixel graphics or geometric objects like lines, polygons and circles in the coordinate system. The diagram shows the coordinate system of the image. Keep in mind that the coordinate of the y-axis has a different orientation than the y-axis in the standard 2D Cartesian coordinate system. This information is relevant if you experiment with equirectangular projections in Projective Geometry Playground.

Calculate the ${\displaystyle y_{sky}}$  for a specific angle of view of your camera.

Calculate the equirectangular projection for any ${\displaystyle (x,y)}$  point in the red circle of the source image IMG into the destination format EQUI with:

Select an implementation of your choice. LibreOffice has the minimal requirements on programming skill but only coordinate transformation can be performed without a visual output.

### Learning Task - Sky - North Pole

A sky image can be used to project a circular area in the source image to the rectangular part at the top of the generated equirectangular image.

Import the equirectangular projection in Aframe to preview the result.

#### Learning Task - Floor - South Pole

Transfer the lesson learned from north pole to the south pole and project the beach image as floor to the south pole.

• What are differences and similarities between both projections?

## References

1. Flattening the Earth: Two Thousand Years of Map Projections, John P. Snyder, 1993, pp. 5–8, ISBN 0-226-76747-7.
2. "Equirectangular Projection - PanoTools.org Wiki". wiki.panotools.org. Retrieved 2021-05-04.
3. "Coordinate Conversion". colorado.edu. Archived from the original on 29 September 2009. Retrieved 14 March 2018.
4. "${\displaystyle \lambda }$  = Longitude east of Greenwich (for longitude west of Greenwich, use a minus sign)."
John P. Snyder, Map Projections, A Working Manual Archived 2010-07-01 at the Wayback Machine, USGS Professional Paper 1395, page ix
5. Farkas, Gábor. "Plate Carrée - a simple example". O’Reilly Online Learning. Retrieved 31 December 2022.
6. Paul A. Longley; Michael F. Goodchild; David J. Maguire; David W. Rhind (2005). Geographic Information Systems and Science. John Wiley & Sons.
7. Flattening the Earth: Two Thousand Years of Map Projections, John P. Snyder, 1993, pp. 7, ISBN 0-226-76747-7.
8. "Equidistant Cylindrical (Plate Carrée)". PROJ coordinate transformation software library. Retrieved 25 August 2020.
9. "Yaw - PanoTools.org Wiki". wiki.panotools.org. Retrieved 2021-05-04.
10. "Pitch - PanoTools.org Wiki". wiki.panotools.org. Retrieved 2021-05-04.
11. Carnë Draug, Hartmut Gimpel, Avinoam Kalma (2022) Image Package Octave URL: https://gnu-octave.github.io/packages/image/ (March, 28th, 2024)