Usage guide

Table of Contents

  1. Usage guide – Coordinate transformations
    1. General
    2. Selection of the coordinate reference system
    3. Single coordinates
    4. Coordinate files
  2. Usage guide – Triangular transformations
    1. General
    2. Finding the point containing triangle
      1. Cross product method
      2. Barycentric coordinates

Usage guide – Coordinate transformations

General

The Web site is divided into two parts. On the left side are the input properties and on the right side the output properties. At first you have to select in both of these a correct coordinate reference system. After that you can type the input coordinates into the text fields or tell to the application how your input file looks like. Additionally, while transforming coordinates to a file you need to specify how you would like the output file to look. The actual transformation is carried on by pressing "Transform".

Selection of the coordinate reference system

You need to select a coordinate reference system for your input coordinates and the output coordinates. The selection is performed in the following order for both the input and output:

  1. Select the datum from the drop down list
  2. Select the coordinate reference system from the drop down list according to it's name
  3. Select a height system
  4. Specify which projection zone you want to use in case of an projected coordinate reference system

The dimensions of the input and output coordinate reference systems have to be same. In case of real 3D coordinate reference systems you can transform the coordinates to a 2D+1D coordinate reference system (plane+height) and vice versa. Allowed height systems include the N60, N2000 and ellipsoidal height (GRS80).

After selecting the coordinate reference system you can type the input coordinates into the text fields or define how the input file looks like.

Kuva koordinaatistojen valinnasta Figure 1. In the picture the user has selected as the input coordinate reference system the ykj and as target coordinate reference system the 3-dimensional EUREF-FIN. The transformation is possible as the input includes a height system (N60).

Single coordinates

The linear unit of single input coordinates is always meter and angular unit is degrees. The desimal delimiter can be a dot or comma, but thousands are not allowed to be marked using white space or commas. The maximum amount to transform single coordinates is ten. The decimal precision is always 0.1 cm. Degrees are rounded to correspond to the same accuracy by using 9 decimals.

While typing the coordinates you need to acknowledge that you type the coordinates in a correct order. The order differs in different coordinate reference systems. The ordering is given above the text fields.

Kuva yksittäisten koordinaattien syöttämisestä Figure 2. In the figure the user has typed in 10 single coordinates after which he has pressed the "Transform"-button.

Coordinate files

The input coordinates can be given and/or the output coordinates returned in an ASCII-file. The maximum size of the input files is set as 5MB (about 50000 lines of coordinates).

Angle pattern and unit

You can select from the input and output properties in which units and with which pattern angles are given or returned. The service support degrees, radians and grades (gons). As the linear unit is always meter as other units are rare in Finland. Angle patterns include floating number formats and some sexagesimal formats of degree:

  • deg – Degrees as floating point numbers
  • rad – Radians as floating point numbers
  • gon – Grades as floating point numbers
  • DDD.dd – Degrees as floating point numbers, where the output coordinates always include three digits in the integer part (also zeros)
  • DD MM SS.ss – Degrees and minutes as integers. Seconds as floating point numbers. Degrees, minutes and seconds are separated using white space (space or tabulator)
  • DD MM.mm – Degrees as integers and seconds as floating point numbers. Degrees and minutes are separated using white space (space or tabulator)
  • DDDMMSS.ss – Degrees and minutes as integers. Seconds as floating point numbers. Degrees are always given using three digits. Integer minutes and the integer part of seconds is given with two digits. All numbers are in row without any white space between them.
  • DDDMM.mm – Degrees as integers and minutes ad floating point numbers. The length of the degrees part is always three digits and the integer part of the minutes two digits. All numbers are written in a row without spaces.

Number of header lines

You can define how many lines long the header of the input file is. This is performed by typing the amount into the Header line count text field. The application dos not use these lines.

Decimal and column delimiters

The coordinate values, point identifiers and all following data has to be separated using white space (space and tabulators) and/or commas. These are called column delimiters. The column delimiter of the input file is automatically determined, but you need to define the delimiter for the output files. For the input you need to define what the decimal delimiter is so that the application does not mix the column delimiter with the decimal separator. While using a comma to separate decimals, you can not use the comma to separate columns.

Identifiers of coordinates

You need to let the application know about existing identifiers by selecting "Use ID infront". You can specify if the input file include identifiers for the points. The identifiers have to be as first in each row separated from the coordinate values with a column delimiter. An identifier can be a name or number. Identifiers are not allowed to contain spaces, tabulators or commas.

When "Use ID infront" is selected in the output properties, the application writes in front of each coordinate an identifier. The identifier is the same as in the input, however, if you defined the file to include identifiers, but some identifier are missing, then these are replaced by "N/A". If you did not include identifiers in the input then the new identifiers are integers beginning from zero.

Coordinates reversed

The order of coordinates, ie. coordinate axes, is the same as in case of single coordinates. The ordering can be also found from the coordinate reference system desciption. You can specify a reversed ordering for the two first coordinate values by selecting Coordinates reversed. The property can be used for both input and output.

Decimal precision

You can decide how many decimals you want to have in an output file. The decimal coutn does not influence the calculation accuracy. The selection choices are given in meters. In case the coordinate values are angular units, the application uses decimal counts corresponding to the decimal precision in meters:

Decimal precisionDecimals in degrees and gradesDecimals in radians
~0.1 mm911
~1 mm810
~1 cm79
~0.1 m68
~1 m57

Line delimiters

Each single point has to be on a single row in the input file. The line delimiter depends on your OS. In the input are accepted all common line delimiters automatically, but for the output you have to define in which OS the data will be used.

The input file can include additional information concerning the points. This information must be given after the point's coordinate values. Use the column delimiter to separate such data. The additional input data can be written to the output by selecting Line ends to output.

Cardinal diractions

You can select if you want to include the cardinal direction of the coordinate value directly after each value. The directions are marked using the letters N, S, W and E.

Usage guide – Triangular transformations

General

A trianglewise or triangular transformation is a transformation, which uses a triangulated (irregular) network. A triangular affine transformation is required, for instance, for the accurate transformation of coordinates between the kkj and EUREF-FIN coordinate reference systems. In addition, a triangular transformation is used between the N60 and N2000 as well as the N43 and N60 height systems.

In case of the projected coordinate reference systems each triangle has its own affine transformation parameters. Thus, the transformation is linear inside each triangle and continuous over triangle edges (, but not differentiable). In case of height transformations each triangle vertex contains the transformation parameters. The transformations are similar in the sense that you are required to first find the triangle defining the transformation parameters.

Finding the point containing triangle

This chapter presents two different methods for finding out if a triangle contains the point for which the transformation parameters are wanted. However, as such the methods are not efficient, but naiive, because you have to go through each triangle of the triangulated network. The search can be enhanced by applying spatial indexing, which reduces the size of the search space. Many spatial indexing methods exist, such as the R-tree, kd-tree, quadtree and the derivatives of these. However, the spatial indexing methods are not introduced in this text.

Cross product method

In the cross product method the coefficients k are used to determine if a point P lies inside a triangle. The triangle is composed from the vertices A, B and C.

The formula for the cross product method

If all coefficients (alpha, beta and lambda) are equally signed, then the point lies inside the triangle. If one of the coefficients is zero, then the point is located on one of the triangle edges, thereby, the triangle is also found. In each other case the point lies outside the triangle.

Background

This chapter goes through the steps behind the method. First all vectors (PA, PB and PC) between the point P and each triangle vertex (A, B and C) are calculated.

Formula for calculating the vectors between the point and vertices

Next the cross products (PA x PB, PB x PC and PC x PA) between all the vectors are calculated.

Formula for calculating the cross product between vectors.

The same formula expressed using determinants

Formula for calculating the cross product between vectors using determinants.

The coefficients k indicate if the point lies inside the triangle

Formula for calculating the cross product

Example 1

The coordinates of the point P and the triangle vertices shall be the following

Coordinates for the calculation example

Calculation of the cross product coefficients k

Calculation example

The point lies outside the triangle, because the coefficients have divergent signs.

Example 2

The co-ordinates of the point P and the triangle vertices shall be the following

Co-ordinates for the calculation example

Calculation of the cross product coefficients k

Calculation example

The point is inside the triangle, because all coefficient signs are equal.

Barycentric coordinates

First we calculate four (or three) help variables

Formula for calculating the help variables for the barycentric coordinates

One of the four help variables can be left uncalculated, if the result does not need to be verified. Next the barycentric coordinates are calculated using the help variables

Formula for calculating the barycentric coordinates

One of the four coordinates can be calculated using two other coordinates, thus, only three help variables are required

Formula for calculating the barycentric coordinates

The point lies inside the triangle if all the barycentric coordinates are in the interval 0..1. The point is located on the triangle edge if one of the coordinates is zero. If two of the coordinates are zeros (and one is 1), then the point is located on one of the triangle vertices.

Background

This chapter goes through the steps behind the method. The barycentric coordinates define the weight of a point (lambda) in terms of the vertices of a simplex. For instance, a 2-dimensional triangle is a simplex (2-simplex) and in the following we only concentrate on the triangle.

After normalisation of the barysentric coordinates their sum becomes 1, at which point

Formula for calculating the barycentric coordinates

If the point lies in the centre of the triangle all barycentric coordinates are 1/3. The barycentric coordinates also show us which proportion of the area of the triangle that is distributed to the sub triangles formed when the point P is connected to the triangle vertices. Thus, if the normalisation is performed using the area of the simplex, the coordinates are called homogeneous barycentric coordinates. In case of the triangle the coordinates are also known as area coordinates. You should be able to recognise from Figure 4 that the area of tA is the largest. Similarly, the weight of the vertex A is the highest. At the same time the weights of the vertices B and C, as the areas of tB and tC, are equal.

Formula for calculating the barycentric coordinates

There are different methods for calculating the barycentric coordinates. Here we present a method that makes use of determinants

Formula for calculating the determinants

Next the barycentric coordinates are solved with the determinants

Formula for calculating the barycentric coordinates

Example 1

The co-ordinates of the point P and the triangle vertices shall be the following

Values for the example of calculating the barycentric coordinates

First calculate the determinants

Calculation example

Next calculate the barycentric coordinates

Calculation example

The point is outside the triangle, because lambdaB is higher than 1 and lambdaC lower than 0. Finally we can verify that the calculation was made correctly by summing all the barycentric coordinates

Calculation example

Example 2

The co-ordinates of the point P and the triangle vertices shall be the following

Values for the example of calculating the barycentric coordinates

First calculate the determinants

Calculation example

Next calculate the barycentric coordinates

Calculation example

The point is inside the triangle, because all the barycentric coordinates are in the interval 0..1. Finally we can verify that the calculation was made correctly by summing all the barycentric coordinates Calculation example