# Accurate Algorithms for Spatial Operations on the Spheroid in a Spatial Database Management System
## 2 Experiments
### Oracle Spatial  
The official documentation mentions that Oracle supports geodetic coordinate systems and says that computation involving large areas or requiring very precise accuracy must account for the curvature of the Earth's surface [24]. It also mentions that Oracle provides a rational and complete treatment of geodetic coordinates. Oracle Spatial uses the spatial SQL operator SDO_GEOM.SDO_INTERSECTION (AB, CD) to intersect two geodesics on the ellipsoid. Scheme 1 shows how the geodesic AB is defined with the coordinates (SDO_ORDINATE_ARRAY) and the reference system 4326 corresponding to WGS84. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **Case 1** & **Case 2** & **Case 3** & **Case 4** \\ \hline Oracle 21c & \(54^{\circ}3^{\prime}26.28372^{\prime\prime}\) & \(51^{\circ}51^{\prime}56.38240^{\prime\prime}\) & \(54^{\circ}40^{\prime}18.17727^{\prime\prime}\) & \(50^{\circ}26^{\prime}39.17191^{\prime\prime}\) \\ Enterprise 1 & \(14^{\circ}31^{\prime}42.77221^{\prime\prime}\) & \(5^{\circ}13^{\prime}38.84516^{\prime\prime}\) & \(-14^{\circ}32^{\prime}38.87404^{\prime\prime}\) & \(-79^{\circ}15^{\prime}0.53507^{\prime\prime}\) \\ Google EE 1 & \(54^{\circ}3^{\prime}26.28372^{\prime\prime}\) & \(51^{\circ}51^{\prime}56.38240^{\prime\prime}\) & \(54^{\circ}40^{\prime}18.17727^{\prime\prime}\) & \(50^{\circ}26^{\prime}39.17191^{\prime\prime}\) \\  & \(14^{\circ}31^{\prime}42.77221^{\prime\prime}\) & \(5^{\circ}13^{\prime}38.84516^{\prime\prime}\) & \(-14^{\circ}32^{\prime}38.87404^{\prime\prime}\) & \(-79^{\circ}15^{\prime}0.53507^{\prime\prime}\) \\ ArcGIS Geodetic & \(54^{\circ}3^{\prime}26.12068^{\prime\prime}\) & \(51^{\circ}51^{\prime}56.30439^{\prime\prime}\) & \(54^{\circ}43^{\prime}1.24560^{\prime\prime}\) & \(50^{\circ}28^{\prime}44.64889^{\prime\prime}\) \\ density 1 & \(14^{\circ}31^{\prime}43.06034^{\prime\prime}\) & \(5^{\circ}13^{\prime}38.81383^{\prime\prime}\) & \(-14^{\circ}33^{\prime}50.01020^{\prime\prime}\) & \(-79^{\circ}16^{\prime}58.15173^{\prime\prime}\) \\ ArcGIS Geodetic & \(54^{\circ}3^{\prime}26.28418^{\prime\prime}\) & \(51^{\circ}51^{\prime}56.30657^{\prime\prime}\) & \(54^{\circ}43^{\prime}1.30662^{\prime}\) & \(50^{\circ}28^{\prime}44.65060^{\prime}\) \\ density + local & & & & \\ projection 2 & \(14^{\circ}31^{\prime}42.77421^{\prime\prime}\) & \(5^{\circ}13^{\prime}38.81450^{\prime\prime}\) & \(-14^{\circ}33^{\prime}49.88149^{\prime\prime}\) & \(-79^{\circ}16^{\prime}58.15211^{\prime\prime}\) \\ PostGIS with & \(54^{\circ}3^{\prime}26.28481^{\prime\prime}\) & \(51^{\circ}51^{\prime}56.39039^{\prime\prime}\) & \(40^{\circ}53^{\prime}7.05995^{\prime\prime}\) & \(36^{\circ}1^{\prime}21.18886\) \\ local projection 2 & \(14^{\circ}31^{\prime}42.77452^{\prime\prime}\) & \(5^{\circ}13^{\prime}38.68764^{\prime\prime}\) & \(-10^{\circ}56^{\prime}51.90552^{\prime\prime}\) & \(-63^{\circ}19^{\prime}23.10184^{\prime\prime}\) \\ Sphere 3 & \(54^{\circ}3^{\prime}26.28 INSERT INTO LINES VALUES(  
'AB',  
SDO_GEOMETRY(  
2002,  
4326, -- WGS84  
NULL,  
SDO_ELEM_INFO_ARRAY(1,2,1), -- LineString Type  
SDO_ORDINATE_ARRAY(5,52,6,51.4)  
**Scheme 1. ** Defining a geodesic geometry with Oracle. Oracle needs a coordinate tolerance to perform any spatial operation. The command shown in Scheme 2 intersects the geodesics AB and CD with a tolerance of 0.05 m, which is the smallest tolerance, allowed by Oracle for geodetic calculations. The resulting coordinates for the intersection are shown in Table 1.  
SELECT sdo_geom.sdo_intersection (11.geom, 12.geom, 0.05)  
FROM lines 11, lines 12  
WHERE 11.name = 'AB' AND 12.name = 'CD' and 11.ncase = 'Case 1';  
**Scheme 2. ** Intersection of two geodesics with Oracle. Table 1 shows that the results from Oracle and the results using a sphere (last row) are completely equal. This is enough to assert that Oracle is not using an ellipsoid in its calculations and therefore does not intersect two geodesics on the ellipsoid but two great circles on the sphere.