USER DEFINED FUNCTION FOR TRANSFORMATION OF ELLIPSOIDAL COORDINATES USER DEFINED FUNKCIJA ZA TRANSFORMACIJU ELIPSOIDNIH KOORDINATA

The topographic plane of the Earth has irregular shape, and for the purpose of mathematical defining, it is to be approximated by rotational ellipsoid. As local geodetic datum, rotational ellipsoids of various sizes are used in the world. More widely usage of the GPS while performing surveying tasks has resulted in the need to define global geodetic datum in order to obtain the best approximation the entire Earth. For this purpose, geocentric rotational ellipsoid WGS84 was defined and the results of the GPS measurements are shown in relation to it. By applying the appropriate equations, the ellipsoidal coordinates are being transformed from WGS84 into the coordinates on the local rotational ellipsoid, i.e. on the view plane. The paper shows User Defined Function created for Excel, by which the coordinates in the territory of Belgrade are being transformed from WGS84 of rotational ellipsoid into the Gauss-Krüger projection plane.


INTRODUCTION
The satellite geodesy today, has a significant role for the navigation and point positioning on Earth.Two satellite navigation systems are known and are used in practice, American GPS and Russian GLONASS.After many years of delay and testing, launching and establishment of the European satellite system GALILEO has begun, which should be completely operative in 2014 (Mendizabal et al. 2009).The position of the receiver on Earth is being determined by the method of pseudo-ranges between known satellite positions and the receivers (French, 1996).Regardless if the surveying is performed by using absolute or differential static, kinematic or kinematic method in real time (RTK), positions of points, i.e. of the receiver, are determined in relation to the rotational ellipsoid WGS84 (World Geodetic System 1984) (Božić, 2006).The so called GPS measurements in Geodesy are more and more present both for the resolving of complex and complicated tasks and when performing basic surveying works, such as surveying and detailed site and objects surveying (Ganić et al. 2012).
Exploratory works in mining and geology are very significant and precede the extraction of mineral raw materials as well as the construction of building, industrial, traffic and all other infrastructural structures.The data on the composition, age and structural-tectonic relations of undersurface parts of the Earth crust are obtained from exploratory wells, and as such they may be used at wider area by using different geological and geophysical tests.In order to apply appropriately the results obtained in this way in other engineering disciplines exploratory wells must be georeferenced, i.e. thy must be shown in the national coordinate system.

Figure 1 -Orthophoto with exploratory wells with ellipsoidal coordinates
Along the Belgrade riverside by the rivers Sava and Danube a large number of special purpose exploratory wells were done (Figure 1), which also were used for explorations of certain stratigraphic members of the neogene and quarternary as well as for the purpose of understanding of kinematic movements (Ganić et al. 2011;Knežević et al. 2011).Some of them were made for the purposes of geotechnical testing of bearing capacity and stability of the terrain for the purpose of construction of the new bridge over Ada Ciganlija.The positioning of those wells was made by using methods of satellite geodesy.However, in individual cases, there were only ellipsoid coordinates of wells at the disposal.This has initiated creation of the WGS2GK function, which is used in Excel and by using which the transformation of ellipsoid coordinates on WGS84 ellipsoid is made into Cartesian coordinates within the plane of Gauss-Krüger projection.

GEOID AND ROTATIONAL ELLIPSOIDS
The topographic plane of the Earth has irregular shape.Difference in elevation between the highest point on Earth and the deepest point in the Pacific Ocean is almost 20 km.
Seas and oceans make more than 70% of the Earth's surface.By connecting all water together, a continuous closed curved line would be obtained, which represents datum level, and a body formed in such a way is called the geoid.Due to the different density and irregular mass arrangement in the Earth's interior, the geoid is slightly waved, with altitude alterations up to 200 m.This waviness is causing the mathematical indefinableness of the geoid.
For mathematical description of geoid, two geometric bodies are used, the sphere and ellipsoid.The sphere is less precise approximation of geoid, which is used with small scales.The ellipsoid is the most accurate approximation of the geoid.Dimensions of rotational ellipsoid are so determined that it approximates geoid best, i.e. that the sum of volumes of exaltations and depressions (undulation) is minimal.Countries adopt the appropriate dimensions of the rotational ellipsoid, the so called local geodetic data, in order to obtain as good approximation on its territory as possible.
As other countries of former Yugoslavia, Serbia has, in 1924, adopted Bessel's ellipsoid as geodetic datum -rotational ellipsoid, whose dimensions were determined in 1841: -semi-major axis of the ellipsoid 6377397.155mMoreover, for mapping from rotational ellipsoid onto the plane the Gauss-Krüger three-stage conform cylindrical projection was adopted.The position of points in the Gauss-Krüger projection is defined by Cartesian coordinates y and x as well as by the altitude (orthometric height) h.
The satellite geodesy has caused the conversion from local non-geocentric data to global datum and introduction of the unique rotational ellipsoid.The reference ellipsoid for GPS positioning is geocentric WGS84 ellipsoid.The position of points on the ellipsoid is defined by: ellipsoidal -curvilinear coordinates (latitude , longitude  and normal -ellipsoidal height H) or by Cartesian -rectangular coordinates, whereby the X-axis lies within the plane of equator and it is normal to intersection point between the equator and Greenwich meridian, and the Y-axis lies within the equator plane and it is normal to X-axis, and the Z-axis is oriented towards the axis of rotation of the Earth.The dimensions of the ellipsoid WGS84 are: -semi-major axis of the ellipsoid 6378137.0mWGS a  ; -flatness 1: 298.257223563 f  .

COORDINATE TRANSFORMATION FROM WGS84 INTO GAUSS-KRÜGER PROJECTION
Transformation of results of GPS measurements into the plane of Gauss-Krüger projection is to be performed at several stages (www.fgg.uni-lj.si): I stage -usual method to show results of GPS measurements is in form of ellipsoidal coordinates, so that at this stage the so called geographical transformation is done, by which the ellipsoidal coordinates are translated into Cartesian coordinates within the same datum (ellipsoid): , , , , The equations are (Bulatović, 2013): whereby: N -is the radius of curve upon the first vertical circle and it is to be calculated by using the following equation: -which is to be calculated by using the equation: WGS b -semi-minor axis of rotational ellipsoid: II stage -datum transformation, by which the Cartesian coordinates are translated from WGS datum into Bessel's ellipsoid: , , , , One of the most commonly use method of datum transformation is Helmert's seven parameter transformation (Liker et al. 2010), which consists of three translations of the origin of coordinates over axes (t x , t y , t z ), three angles of rotation of coordinate axes ( x ,  y ,  z ) and the alteration of scale s (http://ccd.uns.ac.rs): III stage -geographical transformation from Cartesian into ellipsoid coordinates within Bessel's ellipsoid: , , , , The latitude is most often calculated by using the iteration method (Božić, 2001): The first iteration: other iterations: whereby the radius of the curve upon the first vertical circle is calculated after every iteration; and on the basis of this vertical the latitude is calculated in the next iteration.
Simpler equation may also be used here: IV stage -transformation of ellipsoidal coordinates into Cartesian coordinates within the plane of Gauss-Krüger projection, whereby the altitude remains the same: , , , , First, the so called undiminished (unmodulated) coordinates are to be calculated by using the following equations (Božić, 2001):  -auxiliary value: whereby 2 e represents the second numerical eccentricity, which is calculated by using the equation: l -the difference between the latitudes of the point and the central meridian of the mapping zone: The final equations of the point in Gauss-Krüger coordinate system, the so called diminished (modulated) coordinates, are calculated by using the following equations: 0,9999 0,9999 whereby K represents the constant, which amounts 7 500 000 for the seventh coordinate system, i.e. 6 500 000 for the sixth coordinate system.

USER DEFINED FUNCTION WGS2GK
Excel is a part of software package Microsoft Office and it is one of the most frequently applied and most popular software for tabular calculations.It has a large number of ready-made functions divided into nine categories, but it also enables for the users to create their own User Defined Functions (UDF), which are used in the same way as all other functions within Excel (Walkenbach, 2003).
UDFs are created by accessing the Visual Basic Application (Alt+F11), next new module is opened (Insert>Module) and the appropriate program is entered.After exiting Visual Basic Application, created function can be used in Paste Function dialog, in category User Defined.Should the function be available for several workbooks, it is necessary to save Excel's file with created function as add-in file (.xla).By opening the new workbook, the add-in file is loaded (Tools>Add-Ins) and the created function is available for use (Vulić and Durgutović, 2007).
According to the stated options of Excel, and in compliance with the equations stated, the WGS2GK function was created, which transforms ellipsoidal coordinates from WGS84 of the ellipsoid into Cartesian coordinates within Gauss-Krüger system.
The dimensions of both rotational ellipsoids, as well as seven parameters of datum transformations, in fact the parameters for Belgrade, were entered into the program as constants.The translation parameters are given in meters, rotation parameters in seconds and the scale change in ppm.The listing of the WGS2GK function is shown below.

CONCLUSION
By using options of Excel software to create new functions, which are to be used in the same way as the ones already integrated within it, the WGS2GK function was created.The transformation of ellipsoidal coordinates determined by GPS devices into rectangular coordinates within the plane of Gaus-Krüger projection is performed by this function.
The dimensions of rotational ellipsoid WGS84, as well as the Bessel's one, are constants and they are entered into the function.Also, because of the reason for creation of the said function they are entered as constants and parameters applied for Belgrade.Transformation parameters are different with each cadastral municipality, and by entering into Visual Basic Application (Alt+F11) those parameters may be altered (while maintaining units and forms shown in listing).In this way, the WGS2GK function can be used in the entire Serbia as well as in other countries of former Yugoslavia.
latitudes from two consecutive iterations are equal.In this way the final value of latitude on Bessel's ellipsoid  Bes is obtained.Longitude and altitude are calculated by using the following equations: , values of semi-major axis a Bes and semi-minor axis b Bes are used, which define the size of the Bessel's rotational ellipsoid.With those values, the first numerical eccentricity is calculated by using the equation (3).

(
Insert>Function) function is to be inserted and the created function WGS2GK (Figure2) is to be selected from the User Defined category.

Figure 3 -
Figure 3 -Entering of arguments of the WGS2GK function

Figure 4 -
Figure 4 -Results of the transformation of coordinates of exploratory wells Function WGS2GK(fist As Integer, fimn As Integer, fisek As Double, lamst As Integer, lammn As Integer, lamsek As Double, hwgs As Double) As Variant Dim pi As Double Dim awgs As Double, fred As Double Dim fiwgsrad As Double, lamwgsrad As Double Dim bwgs As Double, nwgs As Double Dim xwgs As Double, ywgs As Double, zwgs As Double Dim tx As Double, ty As Double, tz As Double Dim epx As Double, epy As Double, epz As Double Dim s As Double Dim epxrad As Double, epyrad As Double, epzrad As Double