# Coordinate Systems

## #

3D CoordinatesThroughout MapillaryJS, two 3-dimensional coordinate systems are used; Geodetic (WGS84) and Local Topocentric East, North, Up (ENU).

When interacting with the MapillaryJS API you will generally use Geodetic coordinates. In some situations such as when writing custom renderers, you will most probably work with both and convert between them.

##### note

MapillaryJS provides helper functions for geographic coordinates conversion through the enuToGeodetic and geodeticToEnu functions.

### #

Geodetic CoordinatesThe WGS84 datum has longitude (degrees), latitude (degrees) and altitude (meters) values.

### #

Local Topocentric CoordinatesIn the *ENU* (or *World*) reference frame the x-axis points to East, the y-axis to North and the z-axis up. All values are represented in meters.

### #

ConversionCoordinates can be converted between the *geodetic* and *local topocentric* coordinates like so.

Geodetic | ENU | Topocentric | Direction |
---|---|---|---|

Longitude | East | X | Right |

Latitude | North | Y | Forward |

Altitude | Up | Z | Up |

### #

Local Camera CoordinatesWhen writing data provider extensions, you will also need to handle Local camera coordinates.

## #

2D CoordinatesMapillaryJS also works with a number of different 2D coordinate systems.

### #

Container Pixel CoordinatesPixel coordinates are coordinates on the viewer container. The origin is in the top left corner of the container. The axes are directed according to the following for a viewer container with a width of 640 pixels and height of 480 pixels.

`(0,0) (640, 0) +------------------------> | | | v +(0, 480) (640, 480)`

### #

Basic Image CoordinatesBasic image coordinates represents points in the original image adjusted for orientation. They range from 0 to 1 on both axes. The origin is in the top left corner of the image and the axes are directed according to the following for all image types.

`(0,0) (1, 0) +------------------------> | | | v +(0, 1) (1, 1)`

For every camera viewing direction it is possible to convert between these two coordinate systems for the current image. The image can be panned and zoomed independently of the size of the viewer container resulting in different conversion results for different viewing directions

## #

Additional Information##### info

See the OpenSfM coordinate system documentation for additional information about *Normalized image coordinates* (or *OpenSfM coordinates*), *Upright image coordinates* (or *Basic cordinates*), *World coordinates*, and *Local camera coordinates*.