# Android Code Snippet[B4X] GPS Antipode

This is a simple snippet of code...

B4X:
``````' Antipodes -Wikipedia: "The Antipode of any spot on Earth is the point on Earth's surface diametrically opposite to it."
'   In other words:  Given a spot on Earth, the Antipode is the spot on the exact opposite side of the world through the center.
'   Given the decimal degrees for Latitude and Longitude of a spot, these two subs will return the Antipode of that spot
'   Use like:     Log(AntipodeLat(-27.683528))   -and-   Log(AntipodeLng(130.078125))

Sub AntipodeLat (Lat As Double) As Double
Return Lat * -1
End Sub

Sub AntipodeLng (Lng As Double) As Double
If Lng <= 0 Then
Return Lng + 180
Else
Return Lng - 180
End If
End Sub``````

#### Beja

##### Expert
Longtime User
Looks nice .. Thanks for sharing.

#### Beja

##### Expert
Longtime User
This is a simple snippet of code...

B4X:
``````' Antipodes -Wikipedia: "The Antipode of any spot on Earth is the point on Earth's surface diametrically opposite to it."
'   In other words:  Given a spot on Earth, the Antipode is the spot on the exact opposite side of the world through the center.
'   Given the decimal degrees for Latitude and Longitude of a spot, these two subs will return the Antipode of that spot
'   Use like:     Log(AntipodeLat(-27.683528))   -and-   Log(AntipodeLng(130.078125))

Sub AntipodeLat (Lat As Double) As Double
Return Lat * -1
End Sub

Sub AntipodeLng (Lng As Double) As Double
If Lng <= 0 Then
Return Lng + 180
Else
Return Lng - 180
End If
End Sub``````

The Antopode theoretically must have to coordinates.. You are passing only one. Is the right?

#### derez

##### Expert
Longtime User
B4X:
``Return -Lat``

Replies
4
Views
294
Replies
67
Views
5K
Replies
46
Views
6K
Replies
3
Views
3K
Replies
9
Views
4K